/*!--------------------------------------------------------
 * 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 Dk=Object.create;var Ug=Object.defineProperty;var Rb=Object.getOwnPropertyDescriptor;var Wk=Object.getOwnPropertyNames;var Lk=Object.getPrototypeOf,Ak=Object.prototype.hasOwnProperty;var w=(o,r)=>()=>(o&&(r=o(o=0)),r);var Mk=(o,r)=>()=>(r||o((r={exports:{}}).exports,r),r.exports);var Ok=(o,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Wk(r))!Ak.call(o,n)&&n!==e&&Ug(o,n,{get:()=>r[n],enumerable:!(t=Rb(r,n))||t.enumerable});return o};var Db=(o,r,e)=>(e=o!=null?Dk(Lk(o)):{},Ok(r||!o||!o.__esModule?Ug(e,"default",{value:o,enumerable:!0}):e,o));var T=(o,r,e,t)=>{for(var n=t>1?void 0:t?Rb(r,e):r,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(t?s(r,e,n):s(n))||n);return t&&n&&Ug(r,e,n),n},g=(o,r)=>(e,t)=>r(e,t,o);function Bg(o){let r=[];typeof o=="number"&&r.push("code/timeOrigin",o);function e(n,i){r.push(n,i?.startTime??Date.now())}function t(){let n=[];for(let i=0;i<r.length;i+=2)n.push({name:r[i],startTime:r[i+1]});return n}return{mark:e,getMarks:t}}function Bk(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?Bg():{mark(o,r){performance.mark(o,r)},getMarks(){let o=performance.timeOrigin;typeof o!="number"&&(o=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let r=[{name:"code/timeOrigin",startTime:Math.round(o)}];for(let e of performance.getEntriesByType("mark"))r.push({name:e.name,startTime:Math.round(o+e.startTime)});return r}};if(typeof process=="object"){let o=performance?.timeOrigin;return Bg(o)}else return console.trace("perf-util loaded in UNKNOWN environment"),Bg()}function Vk(o){return o.MonacoPerformanceMarks||(o.MonacoPerformanceMarks=Bk()),o.MonacoPerformanceMarks}var Mb,Ne,Sp,ai=w(()=>{Mb=Vk(globalThis),Ne=Mb.mark,Sp=Mb.getMarks});var Kg=Mk((FO,Nb)=>{"use strict";function qk(o,r){var e=o;r.slice(0,-1).forEach(function(n){e=e[n]||{}});var t=r[r.length-1];return t in e}function Fb(o){return typeof o=="number"||/^0x[0-9a-f]+$/i.test(o)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(o)}function Ub(o,r){return r==="constructor"&&typeof o[r]=="function"||r==="__proto__"}Nb.exports=function(o,r){r||(r={});var e={bools:{},strings:{},unknownFn:null};typeof r.unknown=="function"&&(e.unknownFn=r.unknown),typeof r.boolean=="boolean"&&r.boolean?e.allBools=!0:[].concat(r.boolean).filter(Boolean).forEach(function(D){e.bools[D]=!0});var t={};function n(D){return t[D].some(function(F){return e.bools[F]})}Object.keys(r.alias||{}).forEach(function(D){t[D]=[].concat(r.alias[D]),t[D].forEach(function(F){t[F]=[D].concat(t[D].filter(function(ce){return F!==ce}))})}),[].concat(r.string).filter(Boolean).forEach(function(D){e.strings[D]=!0,t[D]&&[].concat(t[D]).forEach(function(F){e.strings[F]=!0})});var i=r.default||{},s={_:[]};function a(D,F){return e.allBools&&/^--[^=]+$/.test(F)||e.strings[D]||e.bools[D]||t[D]}function l(D,F,ce){for(var B=D,ee=0;ee<F.length-1;ee++){var z=F[ee];if(Ub(B,z))return;B[z]===void 0&&(B[z]={}),(B[z]===Object.prototype||B[z]===Number.prototype||B[z]===String.prototype)&&(B[z]={}),B[z]===Array.prototype&&(B[z]=[]),B=B[z]}var Pe=F[F.length-1];Ub(B,Pe)||((B===Object.prototype||B===Number.prototype||B===String.prototype)&&(B={}),B===Array.prototype&&(B=[]),B[Pe]===void 0||e.bools[Pe]||typeof B[Pe]=="boolean"?B[Pe]=ce:Array.isArray(B[Pe])?B[Pe].push(ce):B[Pe]=[B[Pe],ce])}function c(D,F,ce){if(!(ce&&e.unknownFn&&!a(D,ce)&&e.unknownFn(ce)===!1)){var B=!e.strings[D]&&Fb(F)?Number(F):F;l(s,D.split("."),B),(t[D]||[]).forEach(function(ee){l(s,ee.split("."),B)})}}Object.keys(e.bools).forEach(function(D){c(D,i[D]===void 0?!1:i[D])});var d=[];o.indexOf("--")!==-1&&(d=o.slice(o.indexOf("--")+1),o=o.slice(0,o.indexOf("--")));for(var u=0;u<o.length;u++){var f=o[u],m,y;if(/^--.+=/.test(f)){var v=f.match(/^--([^=]+)=([\s\S]*)$/);m=v[1];var S=v[2];e.bools[m]&&(S=S!=="false"),c(m,S,f)}else if(/^--no-.+/.test(f))m=f.match(/^--no-(.+)/)[1],c(m,!1,f);else if(/^--.+/.test(f))m=f.match(/^--(.+)/)[1],y=o[u+1],y!==void 0&&!/^(-|--)[^-]/.test(y)&&!e.bools[m]&&!e.allBools&&(!t[m]||!n(m))?(c(m,y,f),u+=1):/^(true|false)$/.test(y)?(c(m,y==="true",f),u+=1):c(m,e.strings[m]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var I=f.slice(1,-1).split(""),k=!1,R=0;R<I.length;R++){if(y=f.slice(R+2),y==="-"){c(I[R],y,f);continue}if(/[A-Za-z]/.test(I[R])&&y[0]==="="){c(I[R],y.slice(1),f),k=!0;break}if(/[A-Za-z]/.test(I[R])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(y)){c(I[R],y,f),k=!0;break}if(I[R+1]&&I[R+1].match(/\W/)){c(I[R],f.slice(R+2),f),k=!0;break}else c(I[R],e.strings[I[R]]?"":!0,f)}m=f.slice(-1)[0],!k&&m!=="-"&&(o[u+1]&&!/^(-|--)[^-]/.test(o[u+1])&&!e.bools[m]&&(!t[m]||!n(m))?(c(m,o[u+1],f),u+=1):o[u+1]&&/^(true|false)$/.test(o[u+1])?(c(m,o[u+1]==="true",f),u+=1):c(m,e.strings[m]?"":!0,f))}else if((!e.unknownFn||e.unknownFn(f)!==!1)&&s._.push(e.strings._||!Fb(f)?f:Number(f)),r.stopEarly){s._.push.apply(s._,o.slice(u+1));break}}return Object.keys(i).forEach(function(D){qk(s,D.split("."))||(l(s,D.split("."),i[D]),(t[D]||[]).forEach(function(F){l(s,F.split("."),i[D])}))}),r["--"]?s["--"]=d.slice():d.forEach(function(D){s._.push(D)}),s}});function Gk(o){return o.replace(zk,function(r,e,t,n,i,s){if(n)return"";if(i){let a=i.length;return i[a-1]===`
`?i[a-2]==="\r"?`\r
`:`
`:""}else return s?r.substring(1):r})}function Pp(o){let r=Gk(o);try{return JSON.parse(r)}catch{let t=r.replace(/,\s*([}\]])/g,"$1");return JSON.parse(t)}}var zk,$g=w(()=>{zk=/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g});import{homedir as Bb}from"os";import{resolve as jk,isAbsolute as Jk,join as wa}from"path";function Ep(o,r){let e=Xk(o,r),t=[e];return Jk(e)||t.unshift(Qk),jk(...t)}function Xk(o,r){process.env.VSCODE_DEV&&(process.isEmbeddedApp?r="sessions-oss-dev":r="code-oss-dev");let e=process.env.VSCODE_PORTABLE;if(e)return wa(e,"user-data");let t=process.env.VSCODE_APPDATA;if(t)return wa(t,r);let n=o["user-data-dir"];if(n)return n;switch(process.platform){case"win32":if(t=process.env.APPDATA,!t){let i=process.env.USERPROFILE;if(typeof i!="string")throw new Error("Windows: Unexpected undefined %USERPROFILE% environment variable");t=wa(i,"AppData","Roaming")}break;case"darwin":t=wa(Bb(),"Library","Application Support");break;case"linux":t=process.env.XDG_CONFIG_HOME||wa(Bb(),".config");break;default:throw new Error("Platform not supported")}return wa(t,r)}var Qk,qg=w(()=>{Qk=process.env.VSCODE_CWD||process.cwd()});function zg(){return globalThis._VSCODE_NLS_MESSAGES}function ed(){return globalThis._VSCODE_NLS_LANGUAGE}function Tp(o,r){let e;return r.length===0?e=o:e=o.replace(/\{(\d+)\}/g,(t,n)=>{let i=r[parseInt(n)],s=t;return typeof i=="string"?s=i:(typeof i=="number"||typeof i=="boolean"||i===void 0||i===null)&&(s=String(i)),s}),Yk&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),e}function h(o,r,...e){return Tp(typeof o=="number"?Vb(o,r):r,e)}function Vb(o,r){let e=zg()?.[o];if(typeof e!="string"){if(typeof r=="string")return r;throw new Error(`!!! NLS MISSING: ${o} !!!`)}return e}function Gg(o,r,...e){let t;typeof o=="number"?t=Vb(o,r):t=r;let n=Tp(t,e);return{value:n,original:r===t?n:Tp(r,e)}}var Yk,Ce=w(()=>{Yk=ed()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0});function Rp(o){switch(o){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}function Xg(o){return parseFloat(o)>=25}var ws,rd,nd,td,Kb,$b,jg,Zk,qb,zb,eR,Cp,_p,Hb,Gb,Fi,Ui,tn,jb,tR,kp,M,V,ne,Dp,Wp,Dr,rR,Jb,Qb,Ni,li,fn,nR,Jg,iR,Xb,Lt,Qg,Yb,Zb,eS,HO,Y=w(()=>{Ce();ws="en",rd=!1,nd=!1,td=!1,Kb=!1,$b=!1,jg=!1,Zk=!1,qb=!1,zb=!1,eR=!1,_p=ws,Hb=ws,Ui=globalThis;typeof Ui.vscode<"u"&&typeof Ui.vscode.process<"u"?tn=Ui.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(tn=process);jb=typeof tn?.versions?.electron=="string",tR=jb&&tn?.type==="renderer";if(typeof tn=="object"){rd=tn.platform==="win32",nd=tn.platform==="darwin",td=tn.platform==="linux",Kb=td&&!!tn.env.SNAP&&!!tn.env.SNAP_REVISION,Zk=jb,zb=!!tn.env.CI||!!tn.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!tn.env.GITHUB_WORKSPACE,Cp=ws,_p=ws;let o=tn.env.VSCODE_NLS_CONFIG;if(o)try{let r=JSON.parse(o);Cp=r.userLocale,Hb=r.osLocale,_p=r.resolvedLanguage||ws,Gb=r.languagePack?.translationsConfigFile}catch{}$b=!0}else typeof navigator=="object"&&!tR?(Fi=navigator.userAgent,rd=Fi.indexOf("Windows")>=0,nd=Fi.indexOf("Macintosh")>=0,qb=(Fi.indexOf("Macintosh")>=0||Fi.indexOf("iPad")>=0||Fi.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,td=Fi.indexOf("Linux")>=0,eR=Fi?.indexOf("Mobi")>=0,jg=!0,_p=ed()||ws,Cp=navigator.language.toLowerCase(),Hb=Cp):console.error("Unable to resolve platform.");kp=0;nd?kp=1:rd?kp=3:td&&(kp=2);M=rd,V=nd,ne=td,Dp=Kb,Wp=$b,Dr=jg,rR=jg&&typeof Ui.importScripts=="function",Jb=rR?Ui.origin:void 0,Qb=zb,Ni=kp,li=Fi,fn=_p;(t=>{function o(){return fn}t.value=o;function r(){return fn.length===2?fn==="en":fn.length>=3?fn[0]==="e"&&fn[1]==="n"&&fn[2]==="-":!1}t.isDefaultVariant=r;function e(){return fn==="en"}t.isDefault=e})(nR||={});Jg=Gb,iR=typeof Ui.postMessage=="function"&&!Ui.importScripts,Xb=(()=>{if(iR){let o=[];Ui.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let t=0,n=o.length;t<n;t++){let i=o[t];if(i.id===e.data.vscodeScheduleAsyncWork){o.splice(t,1),i.callback();return}}});let r=0;return e=>{let t=++r;o.push({id:t,callback:e}),Ui.postMessage({vscodeScheduleAsyncWork:t},"*")}}return o=>setTimeout(o)})(),Lt=nd||qb?2:rd?1:3,Qg=!!(li&&li.indexOf("Chrome")>=0),Yb=!!(li&&li.indexOf("Firefox")>=0),Zb=!!(!Qg&&li&&li.indexOf("Safari")>=0),eS=!!(li&&li.indexOf("Edg/")>=0),HO=!!(li&&li.indexOf("Android")>=0)});var Is,Yg,mn,Sr,Lp,tS,Bn=w(()=>{Y();Yg=globalThis.vscode;if(typeof Yg<"u"&&typeof Yg.process<"u"){let o=Yg.process;Is={get platform(){return o.platform},get arch(){return o.arch},get env(){return o.env},cwd(){return o.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?Is={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:Is={get platform(){return M?"win32":V?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};mn=Is.cwd,Sr=Is.env,Lp=Is.platform,tS=Is.arch});function dR(o,r){if(o===null||typeof o!="object")throw new Ap(r,"Object",o)}function Nt(o,r){if(typeof o!="string")throw new Ap(r,"string",o)}function De(o){return o===lr||o===rn}function Zg(o){return o===lr}function Vi(o){return o>=oR&&o<=aR||o>=sR&&o<=lR}function Mp(o,r,e,t){let n="",i=0,s=-1,a=0,l=0;for(let c=0;c<=o.length;++c){if(c<o.length)l=o.charCodeAt(c);else{if(t(l))break;l=lr}if(t(l)){if(!(s===c-1||a===1))if(a===2){if(n.length<2||i!==2||n.charCodeAt(n.length-1)!==bs||n.charCodeAt(n.length-2)!==bs){if(n.length>2){let d=n.lastIndexOf(e);d===-1?(n="",i=0):(n=n.slice(0,d),i=n.length-1-n.lastIndexOf(e)),s=c,a=0;continue}else if(n.length!==0){n="",i=0,s=c,a=0;continue}}r&&(n+=n.length>0?`${e}..`:"..",i=2)}else n.length>0?n+=`${e}${o.slice(s+1,c)}`:n=o.slice(s+1,c),i=c-s-1;s=c,a=0}else l===bs&&a!==-1?++a:a=-1}return n}function uR(o){return o?`${o[0]==="."?"":"."}${o}`:""}function nS(o,r){dR(r,"pathObject");let e=r.dir||r.root,t=r.base||`${r.name||""}${uR(r.ext)}`;return e?e===r.root?`${e}${t}`:`${e}${o}${t}`:t}var oR,sR,aR,lR,bs,lr,rn,Bi,cR,Ap,nn,ut,pR,ue,kt,bo,U,It,Op,$e,ye,ba,qO,zO,GO,Bt,Fp,Se=w(()=>{Bn();oR=65,sR=97,aR=90,lR=122,bs=46,lr=47,rn=92,Bi=58,cR=63,Ap=class extends Error{constructor(r,e,t){let n;typeof e=="string"&&e.indexOf("not ")===0?(n="must not be",e=e.replace(/^not /,"")):n="must be";let i=r.indexOf(".")!==-1?"property":"argument",s=`The "${r}" ${i} ${n} of type ${e}`;s+=`. Received type ${typeof t}`,super(s),this.code="ERR_INVALID_ARG_TYPE"}};nn=Lp==="win32";ut={resolve(...o){let r="",e="",t=!1;for(let n=o.length-1;n>=-1;n--){let i;if(n>=0){if(i=o[n],Nt(i,`paths[${n}]`),i.length===0)continue}else r.length===0?i=mn():(i=Sr[`=${r}`]||mn(),(i===void 0||i.slice(0,2).toLowerCase()!==r.toLowerCase()&&i.charCodeAt(2)===rn)&&(i=`${r}\\`));let s=i.length,a=0,l="",c=!1,d=i.charCodeAt(0);if(s===1)De(d)&&(a=1,c=!0);else if(De(d))if(c=!0,De(i.charCodeAt(1))){let u=2,f=u;for(;u<s&&!De(i.charCodeAt(u));)u++;if(u<s&&u!==f){let m=i.slice(f,u);for(f=u;u<s&&De(i.charCodeAt(u));)u++;if(u<s&&u!==f){for(f=u;u<s&&!De(i.charCodeAt(u));)u++;(u===s||u!==f)&&(l=`\\\\${m}\\${i.slice(f,u)}`,a=u)}}}else a=1;else Vi(d)&&i.charCodeAt(1)===Bi&&(l=i.slice(0,2),a=2,s>2&&De(i.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(r.length>0){if(l.toLowerCase()!==r.toLowerCase())continue}else r=l;if(t){if(r.length>0)break}else if(e=`${i.slice(a)}\\${e}`,t=c,c&&r.length>0)break}return e=Mp(e,!t,"\\",De),t?`${r}\\${e}`:`${r}${e}`||"."},normalize(o){Nt(o,"path");let r=o.length;if(r===0)return".";let e=0,t,n=!1,i=o.charCodeAt(0);if(r===1)return Zg(i)?"\\":o;if(De(i))if(n=!0,De(o.charCodeAt(1))){let a=2,l=a;for(;a<r&&!De(o.charCodeAt(a));)a++;if(a<r&&a!==l){let c=o.slice(l,a);for(l=a;a<r&&De(o.charCodeAt(a));)a++;if(a<r&&a!==l){for(l=a;a<r&&!De(o.charCodeAt(a));)a++;if(a===r)return`\\\\${c}\\${o.slice(l)}\\`;a!==l&&(t=`\\\\${c}\\${o.slice(l,a)}`,e=a)}}}else e=1;else Vi(i)&&o.charCodeAt(1)===Bi&&(t=o.slice(0,2),e=2,r>2&&De(o.charCodeAt(2))&&(n=!0,e=3));let s=e<r?Mp(o.slice(e),!n,"\\",De):"";if(s.length===0&&!n&&(s="."),s.length>0&&De(o.charCodeAt(r-1))&&(s+="\\"),!n&&t===void 0&&o.includes(":")){if(s.length>=2&&Vi(s.charCodeAt(0))&&s.charCodeAt(1)===Bi)return`.\\${s}`;let a=o.indexOf(":");do if(a===r-1||De(o.charCodeAt(a+1)))return`.\\${s}`;while((a=o.indexOf(":",a+1))!==-1)}return t===void 0?n?`\\${s}`:s:n?`${t}\\${s}`:`${t}${s}`},isAbsolute(o){Nt(o,"path");let r=o.length;if(r===0)return!1;let e=o.charCodeAt(0);return De(e)||r>2&&Vi(e)&&o.charCodeAt(1)===Bi&&De(o.charCodeAt(2))},join(...o){if(o.length===0)return".";let r,e;for(let i=0;i<o.length;++i){let s=o[i];Nt(s,"path"),s.length>0&&(r===void 0?r=e=s:r+=`\\${s}`)}if(r===void 0)return".";let t=!0,n=0;if(typeof e=="string"&&De(e.charCodeAt(0))){++n;let i=e.length;i>1&&De(e.charCodeAt(1))&&(++n,i>2&&(De(e.charCodeAt(2))?++n:t=!1))}if(t){for(;n<r.length&&De(r.charCodeAt(n));)n++;n>=2&&(r=`\\${r.slice(n)}`)}return ut.normalize(r)},relative(o,r){if(Nt(o,"from"),Nt(r,"to"),o===r)return"";let e=ut.resolve(o),t=ut.resolve(r);if(e===t||(o=e.toLowerCase(),r=t.toLowerCase(),o===r))return"";if(e.length!==o.length||t.length!==r.length){let y=e.split("\\"),v=t.split("\\");y[y.length-1]===""&&y.pop(),v[v.length-1]===""&&v.pop();let S=y.length,I=v.length,k=S<I?S:I,R;for(R=0;R<k&&y[R].toLowerCase()===v[R].toLowerCase();R++);return R===0?t:R===k?I>k?v.slice(R).join("\\"):S>k?"..\\".repeat(S-1-R)+"..":"":"..\\".repeat(S-R)+v.slice(R).join("\\")}let n=0;for(;n<o.length&&o.charCodeAt(n)===rn;)n++;let i=o.length;for(;i-1>n&&o.charCodeAt(i-1)===rn;)i--;let s=i-n,a=0;for(;a<r.length&&r.charCodeAt(a)===rn;)a++;let l=r.length;for(;l-1>a&&r.charCodeAt(l-1)===rn;)l--;let c=l-a,d=s<c?s:c,u=-1,f=0;for(;f<d;f++){let y=o.charCodeAt(n+f);if(y!==r.charCodeAt(a+f))break;y===rn&&(u=f)}if(f!==d){if(u===-1)return t}else{if(c>d){if(r.charCodeAt(a+f)===rn)return t.slice(a+f+1);if(f===2)return t.slice(a+f)}s>d&&(o.charCodeAt(n+f)===rn?u=f:f===2&&(u=3)),u===-1&&(u=0)}let m="";for(f=n+u+1;f<=i;++f)(f===i||o.charCodeAt(f)===rn)&&(m+=m.length===0?"..":"\\..");return a+=u,m.length>0?`${m}${t.slice(a,l)}`:(t.charCodeAt(a)===rn&&++a,t.slice(a,l))},toNamespacedPath(o){if(typeof o!="string"||o.length===0)return o;let r=ut.resolve(o);if(r.length<=2)return o;if(r.charCodeAt(0)===rn){if(r.charCodeAt(1)===rn){let e=r.charCodeAt(2);if(e!==cR&&e!==bs)return`\\\\?\\UNC\\${r.slice(2)}`}}else if(Vi(r.charCodeAt(0))&&r.charCodeAt(1)===Bi&&r.charCodeAt(2)===rn)return`\\\\?\\${r}`;return r},dirname(o){Nt(o,"path");let r=o.length;if(r===0)return".";let e=-1,t=0,n=o.charCodeAt(0);if(r===1)return De(n)?o:".";if(De(n)){if(e=t=1,De(o.charCodeAt(1))){let a=2,l=a;for(;a<r&&!De(o.charCodeAt(a));)a++;if(a<r&&a!==l){for(l=a;a<r&&De(o.charCodeAt(a));)a++;if(a<r&&a!==l){for(l=a;a<r&&!De(o.charCodeAt(a));)a++;if(a===r)return o;a!==l&&(e=t=a+1)}}}}else Vi(n)&&o.charCodeAt(1)===Bi&&(e=r>2&&De(o.charCodeAt(2))?3:2,t=e);let i=-1,s=!0;for(let a=r-1;a>=t;--a)if(De(o.charCodeAt(a))){if(!s){i=a;break}}else s=!1;if(i===-1){if(e===-1)return".";i=e}return o.slice(0,i)},basename(o,r){r!==void 0&&Nt(r,"suffix"),Nt(o,"path");let e=0,t=-1,n=!0,i;if(o.length>=2&&Vi(o.charCodeAt(0))&&o.charCodeAt(1)===Bi&&(e=2),r!==void 0&&r.length>0&&r.length<=o.length){if(r===o)return"";let s=r.length-1,a=-1;for(i=o.length-1;i>=e;--i){let l=o.charCodeAt(i);if(De(l)){if(!n){e=i+1;break}}else a===-1&&(n=!1,a=i+1),s>=0&&(l===r.charCodeAt(s)?--s===-1&&(t=i):(s=-1,t=a))}return e===t?t=a:t===-1&&(t=o.length),o.slice(e,t)}for(i=o.length-1;i>=e;--i)if(De(o.charCodeAt(i))){if(!n){e=i+1;break}}else t===-1&&(n=!1,t=i+1);return t===-1?"":o.slice(e,t)},extname(o){Nt(o,"path");let r=0,e=-1,t=0,n=-1,i=!0,s=0;o.length>=2&&o.charCodeAt(1)===Bi&&Vi(o.charCodeAt(0))&&(r=t=2);for(let a=o.length-1;a>=r;--a){let l=o.charCodeAt(a);if(De(l)){if(!i){t=a+1;break}continue}n===-1&&(i=!1,n=a+1),l===bs?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||n===-1||s===0||s===1&&e===n-1&&e===t+1?"":o.slice(e,n)},format:nS.bind(null,"\\"),parse(o){Nt(o,"path");let r={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return r;let e=o.length,t=0,n=o.charCodeAt(0);if(e===1)return De(n)?(r.root=r.dir=o,r):(r.base=r.name=o,r);if(De(n)){if(t=1,De(o.charCodeAt(1))){let u=2,f=u;for(;u<e&&!De(o.charCodeAt(u));)u++;if(u<e&&u!==f){for(f=u;u<e&&De(o.charCodeAt(u));)u++;if(u<e&&u!==f){for(f=u;u<e&&!De(o.charCodeAt(u));)u++;u===e?t=u:u!==f&&(t=u+1)}}}}else if(Vi(n)&&o.charCodeAt(1)===Bi){if(e<=2)return r.root=r.dir=o,r;if(t=2,De(o.charCodeAt(2))){if(e===3)return r.root=r.dir=o,r;t=3}}t>0&&(r.root=o.slice(0,t));let i=-1,s=t,a=-1,l=!0,c=o.length-1,d=0;for(;c>=t;--c){if(n=o.charCodeAt(c),De(n)){if(!l){s=c+1;break}continue}a===-1&&(l=!1,a=c+1),n===bs?i===-1?i=c:d!==1&&(d=1):i!==-1&&(d=-1)}return a!==-1&&(i===-1||d===0||d===1&&i===a-1&&i===s+1?r.base=r.name=o.slice(s,a):(r.name=o.slice(s,i),r.base=o.slice(s,a),r.ext=o.slice(i,a))),s>0&&s!==t?r.dir=o.slice(0,s-1):r.dir=r.root,r},sep:"\\",delimiter:";",win32:null,posix:null},pR=(()=>{if(nn){let o=/\\/g;return()=>{let r=mn().replace(o,"/");return r.slice(r.indexOf("/"))}}return()=>mn()})(),ue={resolve(...o){let r="",e=!1;for(let t=o.length-1;t>=0&&!e;t--){let n=o[t];Nt(n,`paths[${t}]`),n.length!==0&&(r=`${n}/${r}`,e=n.charCodeAt(0)===lr)}if(!e){let t=pR();r=`${t}/${r}`,e=t.charCodeAt(0)===lr}return r=Mp(r,!e,"/",Zg),e?`/${r}`:r.length>0?r:"."},normalize(o){if(Nt(o,"path"),o.length===0)return".";let r=o.charCodeAt(0)===lr,e=o.charCodeAt(o.length-1)===lr;return o=Mp(o,!r,"/",Zg),o.length===0?r?"/":e?"./":".":(e&&(o+="/"),r?`/${o}`:o)},isAbsolute(o){return Nt(o,"path"),o.length>0&&o.charCodeAt(0)===lr},join(...o){if(o.length===0)return".";let r=[];for(let e=0;e<o.length;++e){let t=o[e];Nt(t,"path"),t.length>0&&r.push(t)}return r.length===0?".":ue.normalize(r.join("/"))},relative(o,r){if(Nt(o,"from"),Nt(r,"to"),o===r||(o=ue.resolve(o),r=ue.resolve(r),o===r))return"";let e=1,t=o.length,n=t-e,i=1,s=r.length-i,a=n<s?n:s,l=-1,c=0;for(;c<a;c++){let u=o.charCodeAt(e+c);if(u!==r.charCodeAt(i+c))break;u===lr&&(l=c)}if(c===a)if(s>a){if(r.charCodeAt(i+c)===lr)return r.slice(i+c+1);if(c===0)return r.slice(i+c)}else n>a&&(o.charCodeAt(e+c)===lr?l=c:c===0&&(l=0));let d="";for(c=e+l+1;c<=t;++c)(c===t||o.charCodeAt(c)===lr)&&(d+=d.length===0?"..":"/..");return`${d}${r.slice(i+l)}`},toNamespacedPath(o){return o},dirname(o){if(Nt(o,"path"),o.length===0)return".";let r=o.charCodeAt(0)===lr,e=-1,t=!0;for(let n=o.length-1;n>=1;--n)if(o.charCodeAt(n)===lr){if(!t){e=n;break}}else t=!1;return e===-1?r?"/":".":r&&e===1?"//":o.slice(0,e)},basename(o,r){r!==void 0&&Nt(r,"suffix"),Nt(o,"path");let e=0,t=-1,n=!0,i;if(r!==void 0&&r.length>0&&r.length<=o.length){if(r===o)return"";let s=r.length-1,a=-1;for(i=o.length-1;i>=0;--i){let l=o.charCodeAt(i);if(l===lr){if(!n){e=i+1;break}}else a===-1&&(n=!1,a=i+1),s>=0&&(l===r.charCodeAt(s)?--s===-1&&(t=i):(s=-1,t=a))}return e===t?t=a:t===-1&&(t=o.length),o.slice(e,t)}for(i=o.length-1;i>=0;--i)if(o.charCodeAt(i)===lr){if(!n){e=i+1;break}}else t===-1&&(n=!1,t=i+1);return t===-1?"":o.slice(e,t)},extname(o){Nt(o,"path");let r=-1,e=0,t=-1,n=!0,i=0;for(let s=o.length-1;s>=0;--s){let a=o[s];if(a==="/"){if(!n){e=s+1;break}continue}t===-1&&(n=!1,t=s+1),a==="."?r===-1?r=s:i!==1&&(i=1):r!==-1&&(i=-1)}return r===-1||t===-1||i===0||i===1&&r===t-1&&r===e+1?"":o.slice(r,t)},format:nS.bind(null,"/"),parse(o){Nt(o,"path");let r={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return r;let e=o.charCodeAt(0)===lr,t;e?(r.root="/",t=1):t=0;let n=-1,i=0,s=-1,a=!0,l=o.length-1,c=0;for(;l>=t;--l){let d=o.charCodeAt(l);if(d===lr){if(!a){i=l+1;break}continue}s===-1&&(a=!1,s=l+1),d===bs?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}if(s!==-1){let d=i===0&&e?1:i;n===-1||c===0||c===1&&n===s-1&&n===i+1?r.base=r.name=o.slice(d,s):(r.name=o.slice(d,n),r.base=o.slice(d,s),r.ext=o.slice(n,s))}return i>0?r.dir=o.slice(0,i-1):e&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};ue.win32=ut.win32=ut;ue.posix=ut.posix=ue;kt=nn?ut.normalize:ue.normalize,bo=nn?ut.isAbsolute:ue.isAbsolute,U=nn?ut.join:ue.join,It=nn?ut.resolve:ue.resolve,Op=nn?ut.relative:ue.relative,$e=nn?ut.dirname:ue.dirname,ye=nn?ut.basename:ue.basename,ba=nn?ut.extname:ue.extname,qO=nn?ut.format:ue.format,zO=nn?ut.parse:ue.parse,GO=nn?ut.toNamespacedPath:ue.toNamespacedPath,Bt=nn?ut.sep:ue.sep,Fp=nn?ut.delimiter:ue.delimiter});function aS(o,r){let e=Object.create(null);for(let t of o){let n=r(t),i=e[n];i||(i=e[n]=[]),i.push(t)}return e}var oS,sS,iS,ev=w(()=>{iS=class{constructor(r,e){this.toKey=e;this._map=new Map;this[oS]="SetWithKey";for(let t of r)this.add(t)}get size(){return this._map.size}add(r){let e=this.toKey(r);return this._map.set(e,r),this}delete(r){return this._map.delete(this.toKey(r))}has(r){return this._map.has(this.toKey(r))}*entries(){for(let r of this._map.values())yield[r,r]}keys(){return this.values()}*values(){for(let r of this._map.values())yield r}clear(){this._map.clear()}forEach(r,e){this._map.forEach(t=>r.call(e,t,t,this))}[(sS=Symbol.iterator,oS=Symbol.toStringTag,sS)](){return this.values()}}});function Bp(o){xa.setUnexpectedErrorHandler(o)}function lS(o){if(!o||typeof o!="object")return!1;let r=o;return r.code==="EPIPE"&&r.syscall?.toUpperCase()==="WRITE"}function rt(o){id(o)||xa.onUnexpectedError(o)}function id(o){return o instanceof Et?!0:o instanceof Error&&o.name===Up&&o.message===Up}function ci(){let o=new Error(Up);return o.name=o.message,o}function Vp(o){return o?new Error(`Illegal state: ${o}`):new Error("Illegal state")}function qt(o){return o?o.message?o.message:o.stack?o.stack.split(`
`)[0]:String(o):"Error"}var tv,xa,Up,Et,Np,Sa,on,Vn,Ve=w(()=>{tv=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(r){setTimeout(()=>{throw r.stack?on.isErrorNoTelemetry(r)?new on(r.message+`

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

`+r.stack):r},0)}}addListener(r){return this.listeners.push(r),()=>{this._removeListener(r)}}emit(r){this.listeners.forEach(e=>{e(r)})}_removeListener(r){this.listeners.splice(this.listeners.indexOf(r),1)}setUnexpectedErrorHandler(r){this.unexpectedErrorHandler=r}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(r){this.unexpectedErrorHandler(r),this.emit(r)}onUnexpectedExternalError(r){this.unexpectedErrorHandler(r)}},xa=new tv;Up="Canceled";Et=class extends Error{constructor(){super(Up),this.name=this.message}},Np=class o extends Error{static{this._name="PendingMigrationError"}static is(r){return r instanceof o||r instanceof Error&&r.name===o._name}constructor(r){super(r),this.name=o._name}};Sa=class extends Error{constructor(){super(...arguments);this.isExpected=!0}},on=class o extends Error{constructor(r){super(r),this.name="CodeExpectedError"}static fromError(r){if(r instanceof o)return r;let e=new o;return e.message=r.message,e.stack=r.stack,e}static isErrorNoTelemetry(r){return r.name==="CodeExpectedError"}},Vn=class o extends Error{constructor(r){super(r||"An unexpected bug occurred."),Object.setPrototypeOf(this,o.prototype)}}});function Hi(o,r){let e=this,t=!1,n;return function(){if(t)return n;if(t=!0,r)try{n=o.apply(e,arguments)}finally{r()}else n=o.apply(e,arguments);return n}}var Pa=w(()=>{});function fR(o,r,e=0,t=o.length){let n=e,i=t;for(;n<i;){let s=Math.floor((n+i)/2);r(o[s])?n=s+1:i=s}return n-1}function uS(o,r,e=0,t=o.length){let n=e,i=t;for(;n<i;){let s=Math.floor((n+i)/2);r(o[s])?i=s:n=s+1}return n}var dS,pS=w(()=>{dS=class o{constructor(r){this._array=r;this._findLastMonotonousLastIdx=0}static{this.assertInvariants=!1}findLastMonotonous(r){if(o.assertInvariants){if(this._prevFindLastPredicate){for(let t of this._array)if(this._prevFindLastPredicate(t)&&!r(t))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=r}let e=fR(this._array,r,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=e+1,e===-1?void 0:this._array[e]}}});function So(o,r,e=(t,n)=>t===n){if(o===r)return!0;if(!o||!r||o.length!==r.length)return!1;for(let t=0,n=o.length;t<n;t++)if(!e(o[t],r[t]))return!1;return!0}function mS(o,r,e){return mR(o.length,t=>e(o[t],r))}function mR(o,r){let e=0,t=o-1;for(;e<=t;){let n=(e+t)/2|0,i=r(n);if(i<0)e=n+1;else if(i>0)t=n-1;else return n}return-(e+1)}function Hp(o,r,e){if(o=o|0,o>=r.length)throw new TypeError("invalid index");let t=r[Math.floor(r.length*Math.random())],n=[],i=[],s=[];for(let a of r){let l=e(a,t);l<0?n.push(a):l>0?i.push(a):s.push(a)}return o<n.length?Hp(o,n,e):o<n.length+s.length?s[0]:Hp(o-(n.length+s.length),i,e)}function hS(o,r,e){if(e===0)return[];let t=o.slice(0,e).sort(r);return hR(o,r,t,e,o.length),t}function hR(o,r,e,t,n){for(let i=e.length;t<n;t++){let s=o[t];if(r(s,e[i-1])<0){e.pop();let a=uS(e,l=>r(s,l)<0);e.splice(a,0,s)}}}function at(o){return o.filter(r=>!!r)}function Wr(o,r=e=>e){let e=new Set;return o.filter(t=>{let n=r(t);return e.has(n)?!1:(e.add(n),!0)})}function rv(o,r){return o.push(r),()=>gR(o,r)}function gR(o,r){let e=o.indexOf(r);if(e>-1)return o.splice(e,1),r}function nv(o,r){let e;if(typeof r=="number"){let t=r;e=()=>{let n=Math.sin(t++)*179426549;return n-Math.floor(n)}}else e=Math.random;for(let t=o.length-1;t>0;t-=1){let n=Math.floor(e()*(t+1)),i=o[t];o[t]=o[n],o[n]=i}}function gS(o){return o[Math.floor(Math.random()*o.length)]}function yS(o,r){return(e,t)=>r(o(e),o(t))}var vS,wS,fS,zt=w(()=>{pS();Ve();(a=>{function o(l){return l<0}a.isLessThan=o;function r(l){return l<=0}a.isLessThanOrEqual=r;function e(l){return l>0}a.isGreaterThan=e;function t(l){return l===0}a.isNeitherLessOrGreaterThan=t,a.greaterThan=1,a.lessThan=-1,a.neitherLessOrGreaterThan=0})(vS||={});wS=(o,r)=>o-r,fS=class o{constructor(r){this.iterate=r}static{this.empty=new o(r=>{})}forEach(r){this.iterate(e=>(r(e),!0))}toArray(){let r=[];return this.iterate(e=>(r.push(e),!0)),r}filter(r){return new o(e=>this.iterate(t=>r(t)?e(t):!0))}map(r){return new o(e=>this.iterate(t=>e(r(t))))}some(r){let e=!1;return this.iterate(t=>(e=r(t),!e)),e}findFirst(r){let e;return this.iterate(t=>r(t)?(e=t,!1):!0),e}findLast(r){let e;return this.iterate(t=>(r(t)&&(e=t),!0)),e}findLastMaxBy(r){let e,t=!0;return this.iterate(n=>((t||vS.isGreaterThan(r(n,e)))&&(t=!1,e=n),!0)),e}}});function PS(o){let r=[];return o.forEach((e,t)=>{r.push(`${t} => ${e}`)}),`Map(${o.size}) {${r.join(", ")}}`}function ES(o){let r=[];return o.forEach(e=>{r.push(e)}),`Set(${o.size}) {${r.join(", ")}}`}function vR(o){return Array.isArray(o)}var iv,bS,gt,SS,Ea,xS,ov,sv,di,Kp,Lr=w(()=>{iv=class{constructor(r,e){this.uri=r;this.value=e}};gt=class o{constructor(r,e){this[bS]="ResourceMap";if(r instanceof o)this.map=new Map(r.map),this.toKey=e??o.defaultToKey;else if(vR(r)){this.map=new Map,this.toKey=e??o.defaultToKey;for(let[t,n]of r)this.set(t,n)}else this.map=new Map,this.toKey=r??o.defaultToKey}static{this.defaultToKey=r=>r.toString()}set(r,e){return this.map.set(this.toKey(r),new iv(r,e)),this}get(r){return this.map.get(this.toKey(r))?.value}has(r){return this.map.has(this.toKey(r))}get size(){return this.map.size}clear(){this.map.clear()}delete(r){return this.map.delete(this.toKey(r))}forEach(r,e){typeof e<"u"&&(r=r.bind(e));for(let[t,n]of this.map)r(n.value,n.uri,this)}*values(){for(let r of this.map.values())yield r.value}*keys(){for(let r of this.map.values())yield r.uri}*entries(){for(let r of this.map.values())yield[r.uri,r.value]}*[(bS=Symbol.toStringTag,Symbol.iterator)](){for(let[,r]of this.map)yield[r.uri,r.value]}},Ea=class{constructor(r,e){this[SS]="ResourceSet";!r||typeof r=="function"?this._map=new gt(r):(this._map=new gt(e),r.forEach(this.add,this))}get size(){return this._map.size}add(r){return this._map.set(r,r),this}clear(){this._map.clear()}delete(r){return this._map.delete(r)}forEach(r,e){this._map.forEach((t,n)=>r.call(e,n,n,this))}has(r){return this._map.has(r)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(SS=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}},ov=class{constructor(){this[xS]="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(r){return this._map.has(r)}get(r,e=0){let t=this._map.get(r);if(t)return e!==0&&this.touch(t,e),t.value}set(r,e,t=0){let n=this._map.get(r);if(n)n.value=e,t!==0&&this.touch(n,t);else{switch(n={key:r,value:e,next:void 0,previous:void 0},t){case 0:this.addItemLast(n);break;case 1:this.addItemFirst(n);break;case 2:this.addItemLast(n);break;default:this.addItemLast(n);break}this._map.set(r,n),this._size++}return this}delete(r){return!!this.remove(r)}remove(r){let e=this._map.get(r);if(e)return this._map.delete(r),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 r=this._head;return this._map.delete(r.key),this.removeItem(r),this._size--,r.value}forEach(r,e){let t=this._state,n=this._head;for(;n;){if(e?r.bind(e)(n.value,n.key,this):r(n.value,n.key,this),this._state!==t)throw new Error("LinkedMap got modified during iteration.");n=n.next}}keys(){let r=this,e=this._state,t=this._head,n={[Symbol.iterator](){return n},next(){if(r._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.key,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}values(){let r=this,e=this._state,t=this._head,n={[Symbol.iterator](){return n},next(){if(r._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.value,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}entries(){let r=this,e=this._state,t=this._head,n={[Symbol.iterator](){return n},next(){if(r._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:[t.key,t.value],done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}[(xS=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(r){if(r>=this.size)return;if(r===0){this.clear();return}let e=this._head,t=this.size;for(;e&&t>r;)this._map.delete(e.key),e=e.next,t--;this._head=e,this._size=t,e&&(e.previous=void 0),this._state++}trimNew(r){if(r>=this.size)return;if(r===0){this.clear();return}let e=this._tail,t=this.size;for(;e&&t>r;)this._map.delete(e.key),e=e.previous,t--;this._tail=e,this._size=t,e&&(e.next=void 0),this._state++}addItemFirst(r){if(!this._head&&!this._tail)this._tail=r;else if(this._head)r.next=this._head,this._head.previous=r;else throw new Error("Invalid list");this._head=r,this._state++}addItemLast(r){if(!this._head&&!this._tail)this._head=r;else if(this._tail)r.previous=this._tail,this._tail.next=r;else throw new Error("Invalid list");this._tail=r,this._state++}removeItem(r){if(r===this._head&&r===this._tail)this._head=void 0,this._tail=void 0;else if(r===this._head){if(!r.next)throw new Error("Invalid list");r.next.previous=void 0,this._head=r.next}else if(r===this._tail){if(!r.previous)throw new Error("Invalid list");r.previous.next=void 0,this._tail=r.previous}else{let e=r.next,t=r.previous;if(!e||!t)throw new Error("Invalid list");e.previous=t,t.next=e}r.next=void 0,r.previous=void 0,this._state++}touch(r,e){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(e!==1&&e!==2)){if(e===1){if(r===this._head)return;let t=r.next,n=r.previous;r===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),r.previous=void 0,r.next=this._head,this._head.previous=r,this._head=r,this._state++}else if(e===2){if(r===this._tail)return;let t=r.next,n=r.previous;r===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),r.next=void 0,r.previous=this._tail,this._tail.next=r,this._tail=r,this._state++}}}toJSON(){let r=[];return this.forEach((e,t)=>{r.push([t,e])}),r}fromJSON(r){this.clear();for(let[e,t]of r)this.set(e,t)}},sv=class extends ov{constructor(r,e=1){super(),this._limit=r,this._ratio=Math.min(Math.max(0,e),1)}get limit(){return this._limit}set limit(r){this._limit=r,this.checkTrim()}get ratio(){return this._ratio}set ratio(r){this._ratio=Math.min(Math.max(0,r),1),this.checkTrim()}get(r,e=2){return super.get(r,e)}peek(r){return super.get(r,0)}set(r,e){return super.set(r,e,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},di=class extends sv{constructor(r,e=1){super(r,e)}trim(r){this.trimOld(r)}set(r,e){return super.set(r,e),this.checkTrim(),this}},Kp=class{constructor(){this.map=new Map}add(r,e){let t=this.map.get(r);t||(t=new Set,this.map.set(r,t)),t.add(e)}delete(r,e){let t=this.map.get(r);t&&(t.delete(e),t.size===0&&this.map.delete(r))}forEach(r,e){let t=this.map.get(r);t&&t.forEach(e)}get(r){let e=this.map.get(r);return e||new Set}}});function $p(o,r){if(!o)throw new Error(r?`Assertion failed (${r})`:"Assertion Failed")}function Ta(o,r="unexpected state"){if(!o)throw typeof r=="string"?new Vn(`Assertion Failed: ${r}`):r}var Ca=w(()=>{Ve()});function Ae(o){return typeof o=="string"}function Je(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)&&!(o instanceof RegExp)&&!(o instanceof Date)}function TS(o){let r=Object.getPrototypeOf(Uint8Array);return typeof o=="object"&&o instanceof r}function Hn(o){return typeof o=="number"&&!isNaN(o)}function CS(o){return!!o&&typeof o[Symbol.iterator]=="function"}function qp(o){return o===!0||o===!1}function En(o){return typeof o>"u"}function _S(o){return!At(o)}function At(o){return En(o)||o===null}function kS(o,r){if(!o)throw new Error(r?`Unexpected type, expected '${r}'`:"Unexpected type")}function ui(o){return Ta(o!=null,"Argument is `undefined` or `null`."),o}function zp(o){if(!Je(o))return!1;for(let r in o)if(wR.call(o,r))return!1;return!0}function od(o){return typeof o=="function"}function Tn(o,r){for(let e in r)if(!(e in o))return!1;return!0}var wR,We=w(()=>{Ca();wR=Object.prototype.hasOwnProperty});var pi,sd=w(()=>{We();(ce=>{function o(B){return!!B&&typeof B=="object"&&typeof B[Symbol.iterator]=="function"}ce.is=o;let r=Object.freeze([]);function e(){return r}ce.empty=e;function*t(B){yield B}ce.single=t;function n(B){return o(B)?B:t(B)}ce.wrap=n;function i(B){return B??r}ce.from=i;function*s(B){for(let ee=B.length-1;ee>=0;ee--)yield B[ee]}ce.reverse=s;function a(B){return!B||B[Symbol.iterator]().next().done===!0}ce.isEmpty=a;function l(B){return B[Symbol.iterator]().next().value}ce.first=l;function c(B,ee){let z=0;for(let Pe of B)if(ee(Pe,z++))return!0;return!1}ce.some=c;function d(B,ee){let z=0;for(let Pe of B)if(!ee(Pe,z++))return!1;return!0}ce.every=d;function u(B,ee){for(let z of B)if(ee(z))return z}ce.find=u;function*f(B,ee){for(let z of B)ee(z)&&(yield z)}ce.filter=f;function*m(B,ee){let z=0;for(let Pe of B)yield ee(Pe,z++)}ce.map=m;function*y(B,ee){let z=0;for(let Pe of B)yield*ee(Pe,z++)}ce.flatMap=y;function*v(...B){for(let ee of B)CS(ee)?yield*ee:yield ee}ce.concat=v;function S(B,ee,z){let Pe=z;for(let Pt of B)Pe=ee(Pe,Pt);return Pe}ce.reduce=S;function I(B){let ee=0;for(let z of B)ee++;return ee}ce.length=I;function*k(B,ee,z=B.length){for(ee<-B.length&&(ee=0),ee<0&&(ee+=B.length),z<0?z+=B.length:z>B.length&&(z=B.length);ee<z;ee++)yield B[ee]}ce.slice=k;function R(B,ee=Number.POSITIVE_INFINITY){let z=[];if(ee===0)return[z,B];let Pe=B[Symbol.iterator]();for(let Pt=0;Pt<ee;Pt++){let Ft=Pe.next();if(Ft.done)return[z,ce.empty()];z.push(Ft.value)}return[z,{[Symbol.iterator](){return Pe}}]}ce.consume=R;async function D(B){let ee=[];for await(let z of B)ee.push(z);return ee}ce.asyncToArray=D;async function F(B){let ee=[];for await(let z of B)ee=ee.concat(z);return ee}ce.asyncToArrayFlat=F})(pi||={})});function bR(o){ka=o}function ad(o){return ka?.trackDisposable(o),o}function ld(o){ka?.markAsDisposed(o)}function Ss(o,r){ka?.setParent(o,r)}function SR(o,r){if(ka)for(let e of o)ka.setParent(e,r)}function Gp(o){return typeof o=="object"&&o!==null&&typeof o.dispose=="function"&&o.dispose.length===0}function pt(o){if(pi.is(o)){let r=[];for(let e of o)if(e)try{e.dispose()}catch(t){r.push(t)}if(r.length===1)throw r[0];if(r.length>1)throw new AggregateError(r,"Encountered errors while disposing of store");return Array.isArray(o)?[]:o}else if(o)return o.dispose(),o}function DS(...o){let r=j(()=>pt(o));return SR(o,r),r}function j(o){return new av(o)}function WS(o,r){return o.then(e=>(r.isDisposed?e.dispose():r.add(e),e))}var IR,ka,RS,av,te,C,er,cr,K=w(()=>{zt();ev();Lr();Pa();sd();Ve();IR=!1,ka=null,RS=class o{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(r){let e=this.livingDisposables.get(r);return e||(e={parent:null,source:null,isSingleton:!1,value:r,idx:o.idx++},this.livingDisposables.set(r,e)),e}trackDisposable(r){let e=this.getDisposableData(r);e.source||(e.source=new Error().stack)}setParent(r,e){let t=this.getDisposableData(r);t.parent=e}markAsDisposed(r){this.livingDisposables.delete(r)}markAsSingleton(r){this.getDisposableData(r).isSingleton=!0}getRootParent(r,e){let t=e.get(r);if(t)return t;let n=r.parent?this.getRootParent(this.getDisposableData(r.parent),e):r;return e.set(r,n),n}getTrackedDisposables(){let r=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,r).isSingleton).flatMap(([t])=>t)}computeLeakingDisposables(r=10,e){let t;if(e)t=e;else{let l=new Map,c=[...this.livingDisposables.values()].filter(u=>u.source!==null&&!this.getRootParent(u,l).isSingleton);if(c.length===0)return;let d=new Set(c.map(u=>u.value));if(t=c.filter(u=>!(u.parent&&d.has(u.parent))),t.length===0)throw new Error("There are cyclic diposable chains!")}if(!t)return;function n(l){function c(u,f){for(;u.length>0&&f.some(m=>typeof m=="string"?m===u[0]:u[0].match(m));)u.shift()}let d=l.source.split(`
`).map(u=>u.trim().replace("at ","")).filter(u=>u!=="");return c(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let i=new Kp;for(let l of t){let c=n(l);for(let d=0;d<=c.length;d++)i.add(c.slice(0,d).join(`
`),l)}t.sort(yS(l=>l.idx,wS));let s="",a=0;for(let l of t.slice(0,r)){a++;let c=n(l),d=[];for(let u=0;u<c.length;u++){let f=c[u];f=`(shared with ${i.get(c.slice(0,u+1).join(`
`)).size}/${t.length} leaks) at ${f}`;let y=i.get(c.slice(0,u).join(`
`)),v=aS([...y].map(S=>n(S)[u]),S=>S);delete v[c[u]];for(let[S,I]of Object.entries(v))I&&d.unshift(`    - stacktraces of ${I.length} other leaks continue with ${S}`);d.unshift(f)}s+=`


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

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


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

`),{leaks:t,details:s}}};if(IR){let o="__is_disposable_tracked__";bR(new class{trackDisposable(r){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{r[o]||console.log(e)},3e3)}setParent(r,e){if(r&&r!==C.None)try{r[o]=!0}catch{}}markAsDisposed(r){if(r&&r!==C.None)try{r[o]=!0}catch{}}markAsSingleton(r){}})}av=class{constructor(r){this._isDisposed=!1,this._fn=r,ad(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,ld(this),this._fn()}}};te=class o{constructor(){this._toDispose=new Set;this._isDisposed=!1;ad(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(ld(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pt(this._toDispose)}finally{this._toDispose.clear()}}add(r){if(!r||r===C.None)return r;if(r===this)throw new Error("Cannot register a disposable on itself!");return Ss(r,this),this._isDisposed?o.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(r),r}delete(r){if(r){if(r===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(r),r.dispose()}}deleteAndLeak(r){r&&this._toDispose.delete(r)&&Ss(r,null)}assertNotDisposed(){this._isDisposed&&rt(new Vn("Object disposed"))}},C=class{constructor(){this._store=new te;ad(this),Ss(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){ld(this),this._store.dispose()}_register(r){if(r===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(r)}},er=class{constructor(){this._isDisposed=!1;ad(this)}get value(){return this._isDisposed?void 0:this._value}set value(r){this._isDisposed||r===this._value||(this._value?.dispose(),r&&Ss(r,this),this._value=r)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ld(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let r=this._value;return this._value=void 0,r&&Ss(r,null),r}},cr=class{constructor(r=new Map){this._isDisposed=!1;this._store=r,ad(this)}dispose(){ld(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{pt(this._store.values())}finally{this._store.clear()}}has(r){return this._store.has(r)}get size(){return this._store.size}get(r){return this._store.get(r)}set(r,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(r)?.dispose(),this._store.set(r,e),Ss(e,this)}deleteAndDispose(r){this._store.get(r)?.dispose(),this._store.delete(r)}deleteAndLeak(r){let e=this._store.get(r);return e&&Ss(e,null),this._store.delete(r),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}});var bt,Ra,lv=w(()=>{bt=class o{static{this.Undefined=new o(void 0)}constructor(r){this.element=r,this.next=o.Undefined,this.prev=o.Undefined}},Ra=class{constructor(){this._first=bt.Undefined;this._last=bt.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===bt.Undefined}clear(){let r=this._first;for(;r!==bt.Undefined;){let e=r.next;r.prev=bt.Undefined,r.next=bt.Undefined,r=e}this._first=bt.Undefined,this._last=bt.Undefined,this._size=0}unshift(r){return this._insert(r,!1)}push(r){return this._insert(r,!0)}_insert(r,e){let t=new bt(r);if(this._first===bt.Undefined)this._first=t,this._last=t;else if(e){let i=this._last;this._last=t,t.prev=i,i.next=t}else{let i=this._first;this._first=t,t.next=i,i.prev=t}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(t))}}shift(){if(this._first!==bt.Undefined){let r=this._first.element;return this._remove(this._first),r}}pop(){if(this._last!==bt.Undefined){let r=this._last.element;return this._remove(this._last),r}}peek(){if(this._last!==bt.Undefined)return this._last.element}_remove(r){if(r.prev!==bt.Undefined&&r.next!==bt.Undefined){let e=r.prev;e.next=r.next,r.next.prev=e}else r.prev===bt.Undefined&&r.next===bt.Undefined?(this._first=bt.Undefined,this._last=bt.Undefined):r.next===bt.Undefined?(this._last=this._last.prev,this._last.next=bt.Undefined):r.prev===bt.Undefined&&(this._first=this._first.next,this._first.prev=bt.Undefined);this._size-=1}*[Symbol.iterator](){let r=this._first;for(;r!==bt.Undefined;)yield r.element,r=r.next}}});var xR,sn,xs=w(()=>{xR=globalThis.performance.now.bind(globalThis.performance),sn=class o{static create(r){return new o(r)}constructor(r){this._now=r===!1?Date.now:xR,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}}});function mv(o,r){r instanceof te?r.add(o):Array.isArray(r)&&r.push(o)}function MS(o,r){if(r instanceof te)r.delete(o);else if(Array.isArray(r)){let e=r.indexOf(o);e!==-1&&r.splice(e,1)}o.dispose()}var LS,PR,E,cv,AS,dv,cd,uv,pv,ER,Da,TR,CR,x,fv,Ps,jp,dd,Q=w(()=>{ev();Ve();Pa();K();lv();xs();LS=!1,PR=!1;(Nr=>{Nr.None=()=>C.None;function r(X){if(PR){let{onDidAddListener:$}=X,J=cd.create(),G=0;X.onDidAddListener=()=>{++G===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),J.print()),$?.()}}}function e(X,$,J){return m(X,()=>{},0,void 0,$??!0,void 0,J)}Nr.defer=e;function t(X){return($,J=null,G)=>{let ie=!1,ve;return ve=X(Re=>{if(!ie)return ve?ve.dispose():ie=!0,$.call(J,Re)},null,G),ie&&ve.dispose(),ve}}Nr.once=t;function n(X,$){return Nr.once(Nr.filter(X,$))}Nr.onceIf=n;function i(X,$,J){return u((G,ie=null,ve)=>X(Re=>G.call(ie,$(Re)),null,ve),J)}Nr.map=i;function s(X,$,J){return u((G,ie=null,ve)=>X(Re=>{$(Re),G.call(ie,Re)},null,ve),J)}Nr.forEach=s;function a(X,$,J){return u((G,ie=null,ve)=>X(Re=>$(Re)&&G.call(ie,Re),null,ve),J)}Nr.filter=a;function l(X){return X}Nr.signal=l;function c(...X){return($,J=null,G)=>{let ie=DS(...X.map(ve=>ve(Re=>$.call(J,Re))));return f(ie,G)}}Nr.any=c;function d(X,$,J,G){let ie=J;return i(X,ve=>(ie=$(ie,ve),ie),G)}Nr.reduce=d;function u(X,$){let J,G={onWillAddFirstListener(){J=X(ie.fire,ie)},onDidRemoveLastListener(){J?.dispose()}};$||r(G);let ie=new x(G);return $?.add(ie),ie.event}function f(X,$){return $ instanceof Array?$.push(X):$&&$.add(X),X}function m(X,$,J=100,G=!1,ie=!1,ve,Re){let dt,tt,Zt,sr=0,Br,Be={leakWarningThreshold:ve,onWillAddFirstListener(){dt=X(Gc=>{sr++,tt=$(tt,Gc),G&&!Zt&&(oi.fire(tt),tt=void 0),Br=()=>{let jc=tt;tt=void 0,Zt=void 0,(!G||sr>1)&&oi.fire(jc),sr=0},typeof J=="number"?(Zt&&clearTimeout(Zt),Zt=setTimeout(Br,J)):Zt===void 0&&(Zt=null,queueMicrotask(Br))})},onWillRemoveListener(){ie&&sr>0&&Br?.()},onDidRemoveLastListener(){Br=void 0,dt.dispose()}};Re||r(Be);let oi=new x(Be);return Re?.add(oi),oi.event}Nr.debounce=m;function y(X,$=0,J,G){return Nr.debounce(X,(ie,ve)=>ie?(ie.push(ve),ie):[ve],$,void 0,J??!0,void 0,G)}Nr.accumulate=y;function v(X,$,J=100,G=!0,ie=!0,ve,Re){let dt,tt,Zt,sr=0,Br={leakWarningThreshold:ve,onWillAddFirstListener(){dt=X(oi=>{sr++,tt=$(tt,oi),Zt===void 0&&(G&&(Be.fire(tt),tt=void 0,sr=0),typeof J=="number"?Zt=setTimeout(()=>{ie&&sr>0&&Be.fire(tt),tt=void 0,Zt=void 0,sr=0},J):(Zt=0,queueMicrotask(()=>{ie&&sr>0&&Be.fire(tt),tt=void 0,Zt=void 0,sr=0})))})},onDidRemoveLastListener(){dt.dispose()}};Re||r(Br);let Be=new x(Br);return Re?.add(Be),Be.event}Nr.throttle=v;function S(X,$=(G,ie)=>G===ie,J){let G=!0,ie;return a(X,ve=>{let Re=G||!$(ve,ie);return G=!1,ie=ve,Re},J)}Nr.latch=S;function I(X,$,J){return[Nr.filter(X,$,J),Nr.filter(X,G=>!$(G),J)]}Nr.split=I;function k(X,$=!1,J=[],G){let ie=J.slice(),ve=X(tt=>{ie?ie.push(tt):dt.fire(tt)});G&&G.add(ve);let Re=()=>{ie?.forEach(tt=>dt.fire(tt)),ie=null},dt=new x({onWillAddFirstListener(){ve||(ve=X(tt=>dt.fire(tt)),G&&G.add(ve))},onDidAddFirstListener(){ie&&($?setTimeout(Re):Re())},onDidRemoveLastListener(){ve&&ve.dispose(),ve=null}});return G&&G.add(dt),dt.event}Nr.buffer=k;function R(X,$){return(G,ie,ve)=>{let Re=$(new F);return X(function(dt){let tt=Re.evaluate(dt);tt!==D&&G.call(ie,tt)},void 0,ve)}}Nr.chain=R;let D=Symbol("HaltChainable");class F{constructor(){this.steps=[]}map($){return this.steps.push($),this}forEach($){return this.steps.push(J=>($(J),J)),this}filter($){return this.steps.push(J=>$(J)?J:D),this}reduce($,J){let G=J;return this.steps.push(ie=>(G=$(G,ie),G)),this}latch($=(J,G)=>J===G){let J=!0,G;return this.steps.push(ie=>{let ve=J||!$(ie,G);return J=!1,G=ie,ve?ie:D}),this}evaluate($){for(let J of this.steps)if($=J($),$===D)break;return $}}function ce(X,$,J=G=>G){let G=(...dt)=>Re.fire(J(...dt)),ie=()=>X.on($,G),ve=()=>X.removeListener($,G),Re=new x({onWillAddFirstListener:ie,onDidRemoveLastListener:ve});return Re.event}Nr.fromNodeEventEmitter=ce;function B(X,$,J=G=>G){let G=(...dt)=>Re.fire(J(...dt)),ie=()=>X.addEventListener($,G),ve=()=>X.removeEventListener($,G),Re=new x({onWillAddFirstListener:ie,onDidRemoveLastListener:ve});return Re.event}Nr.fromDOMEventEmitter=B;function ee(X,$){let J,G,ie=new Promise(ve=>{G=t(X)(ve),mv(G,$),J=()=>{MS(G,$)}});return ie.cancel=J,$&&ie.finally(()=>MS(G,$)),ie}Nr.toPromise=ee;function z(X,$){return X(J=>$.fire(J))}Nr.forward=z;function Pe(X,$,J){return $(J),X(G=>$(G))}Nr.runAndSubscribe=Pe;class Pt{constructor($,J){this._observable=$;this._counter=0;this._hasChanged=!1;let G={onWillAddFirstListener:()=>{$.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{$.removeObserver(this)}};J||r(G),this.emitter=new x(G),J&&J.add(this.emitter)}beginUpdate($){this._counter++}handlePossibleChange($){}handleChange($,J){this._hasChanged=!0}endUpdate($){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Ft(X,$){return new Pt(X,$).emitter.event}Nr.fromObservable=Ft;function Ur(X){return($,J,G)=>{let ie=0,ve=!1,Re={beginUpdate(){ie++},endUpdate(){ie--,ie===0&&(X.reportChanges(),ve&&(ve=!1,$.call(J)))},handlePossibleChange(){},handleChange(){ve=!0}};X.addObserver(Re),X.reportChanges();let dt={dispose(){X.removeObserver(Re)}};return mv(dt,G),dt}}Nr.fromObservableLight=Ur})(E||={});cv=class o{constructor(r){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${r}_${o._idPool++}`,o.all.add(this)}static{this.all=new Set}static{this._idPool=0}start(r){this._stopWatch=new sn,this.listenerCount=r}stop(){if(this._stopWatch){let r=this._stopWatch.elapsed();this.durations.push(r),this.elapsedOverall+=r,this.invocationCount+=1,this._stopWatch=void 0}}},AS=-1,dv=class o{constructor(r,e,t=(o._idPool++).toString(16).padStart(3,"0")){this._errorHandler=r;this.threshold=e;this.name=t;this._warnCountdown=0}static{this._idPool=1}dispose(){this._stacks?.clear()}check(r,e){let t=this.threshold;if(t<=0||e<t)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(r.value)||0;if(this._stacks.set(r.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=t*.5;let[i,s]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${s}):`;console.warn(a),console.warn(i);let l=new uv(a,i);this._errorHandler(l)}return()=>{let i=this._stacks.get(r.value)||0;this._stacks.set(r.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let r,e=0;for(let[t,n]of this._stacks)(!r||e<n)&&(r=[t,n],e=n);return r}},cd=class o{constructor(r){this.value=r}static create(){let r=new Error;return new o(r.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},uv=class extends Error{constructor(r,e){super(r),this.name="ListenerLeakError",this.stack=e}},pv=class extends Error{constructor(r,e){super(r),this.name="ListenerRefusalError",this.stack=e}},ER=0,Da=class{constructor(r){this.value=r;this.id=ER++}},TR=2,CR=(o,r)=>{if(o instanceof Da)r(o);else for(let e=0;e<o.length;e++){let t=o[e];t&&r(t)}},x=class{constructor(r){this._size=0;this._options=r,this._leakageMon=AS>0||this._options?.leakWarningThreshold?new dv(r?.onListenerError??rt,this._options?.leakWarningThreshold??AS):void 0,this._perfMon=this._options?._profName?new cv(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(LS){let r=this._listeners;queueMicrotask(()=>{CR(r,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(r,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],d=new pv(`${l}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||rt)(d),C.None}if(this._disposed)return C.None;e&&(r=r.bind(e));let n=new Da(r),i,s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=cd.create(),i=this._leakageMon.check(n.stack,this._size+1)),LS&&(n.stack=s??cd.create()),this._listeners?this._listeners instanceof Da?(this._deliveryQueue??=new fv,this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;let a=j(()=>{i?.(),this._removeListener(n)});return mv(a,t),a},this._event}_removeListener(r){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(r);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 n=this._deliveryQueue.current===this;if(this._size*TR<=e.length){let i=0;for(let s=0;s<e.length;s++)e[s]?e[i++]=e[s]:n&&i<this._deliveryQueue.end&&(this._deliveryQueue.end--,i<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=i}}_deliver(r,e){if(!r)return;let t=this._options?.onListenerError||rt;if(!t){r.value(e);return}try{r.value(e)}catch(n){t(n)}}_deliverQueue(r){let e=r.current._listeners;for(;r.i<r.end;)this._deliver(e[r.i++],r.value);r.reset()}fire(r){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Da)this._deliver(this._listeners,r);else{let e=this._deliveryQueue;e.enqueue(this,r,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},fv=class{constructor(){this.i=-1;this.end=0}enqueue(r,e,t){this.i=0,this.end=t,this.current=r,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ps=class extends x{constructor(e){super(e);this._isPaused=0;this._eventQueue=new Ra;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))}},jp=class{constructor(){this.hasListeners=!1;this.events=[];this.emitter=new x({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(r){let e={event:r,listener:null};return this.events.push(e),this.hasListeners&&this.hook(e),j(Hi(()=>{this.hasListeners&&this.unhook(e);let n=this.events.indexOf(e);this.events.splice(n,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(r=>this.hook(r))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(r=>this.unhook(r))}hook(r){r.listener=r.event(e=>this.emitter.fire(e))}unhook(r){r.listener?.dispose(),r.listener=null}dispose(){this.emitter.dispose();for(let r of this.events)r.listener?.dispose();this.events=[]}},dd=class{constructor(){this.listening=!1;this.inputEvent=E.None;this.inputEventListener=C.None;this.emitter=new x({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(r){this.inputEvent=r,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=r(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}});var OS,be,Wa,qe,St=w(()=>{Q();K();OS=Object.freeze(function(o,r){let e=setTimeout(o.bind(r),0);return{dispose(){clearTimeout(e)}}});(t=>{function o(n){return n===t.None||n===t.Cancelled||n instanceof Wa?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}t.isCancellationToken=o,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:E.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:OS})})(be||={});Wa=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?OS:(this._emitter||(this._emitter=new x),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},qe=class{constructor(r){this._token=void 0;this._parentListener=void 0;this._parentListener=r&&r.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new Wa),this._token}cancel(){this._token?this._token instanceof Wa&&this._token.cancel():this._token=be.Cancelled}dispose(r=!1){r&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof Wa&&this._token.dispose():this._token=be.None}}});var Kn=w(()=>{});function _R(o){return o}var Jp,FS=w(()=>{St();Jp=class{constructor(r,e){this.lastCache=void 0;this.lastArgKey=void 0;typeof r=="function"?(this._fn=r,this._computeKey=_R):(this._fn=e,this._computeKey=r.getCacheKey)}get(r){let e=this._computeKey(r);return this.lastArgKey!==e&&(this.lastArgKey=e,this.lastCache=this._fn(r)),this.lastCache}}});var xr,xo=w(()=>{xr=class{constructor(r){this.executor=r;this._state=0}get hasValue(){return this._state===2}get value(){if(this._state===0){this._state=1;try{this._value=this.executor()}catch(r){this._error=r}finally{this._state=2}}else if(this._state===1)throw new Error("Cannot read the value of a lazy that is being initialized");if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}});var US=w(()=>{});function KS(o){return!o||typeof o!="string"?!0:o.trim().length===0}function Po(o){return o.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function hv(o,r=" "){let e=gv(o,r);return $n(e,r)}function gv(o,r){if(!o||!r)return o;let e=r.length,t=0;if(e===1){let n=r.charCodeAt(0);for(;t<o.length&&o.charCodeAt(t)===n;)t++}else for(;o.startsWith(r,t);)t+=e;return o.substring(t)}function $n(o,r){if(!o||!r)return o;let e=r.length,t=o.length;if(e===1){let i=t,s=r.charCodeAt(0);for(;i>0&&o.charCodeAt(i-1)===s;)i--;return o.substring(0,i)}let n=t;for(;n>0&&o.endsWith(r,n);)n-=e;return o.substring(0,n)}function ud(o,r){return o<r?-1:o>r?1:0}function Qp(o,r,e=0,t=o.length,n=0,i=r.length){for(;e<t&&n<i;e++,n++){let l=o.charCodeAt(e),c=r.charCodeAt(n);if(l<c)return-1;if(l>c)return 1}let s=t-e,a=i-n;return s<a?-1:s>a?1:0}function pd(o,r){return Es(o,r,0,o.length,0,r.length)}function Es(o,r,e=0,t=o.length,n=0,i=r.length){for(;e<t&&n<i;e++,n++){let l=o.charCodeAt(e),c=r.charCodeAt(n);if(l===c)continue;if(l>=128||c>=128)return Qp(o.toLowerCase(),r.toLowerCase(),e,t,n,i);NS(l)&&(l-=32),NS(c)&&(c-=32);let d=l-c;if(d!==0)return d}let s=t-e,a=i-n;return s<a?-1:s>a?1:0}function NS(o){return o>=97&&o<=122}function vv(o){return o>=65&&o<=90}function Hr(o,r){return o.length===r.length&&Es(o,r)===0}function Eo(o,r){let e=r.length;return e<=o.length&&Es(o,r,0,e)===0}function $S(o,r){let e=o.length,t=e-r.length;return t>=0&&Es(o,r,t,e)===0}function qS(o){return 55296<=o&&o<=56319}function yv(o){return 56320<=o&&o<=57343}function zS(o,r){return(o-55296<<10)+(r-56320)+65536}function WR(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}var kR,RR,DR,UF,NF,BS,VS,HS,dr=w(()=>{FS();Kn();xo();US();kR=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,RR=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,DR=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,UF=new RegExp("(?:"+[kR.source,RR.source,DR.source].join("|")+")","g"),NF=String.fromCharCode(65279),BS=class o{static{this._INSTANCE=null}static getInstance(){return o._INSTANCE||(o._INSTANCE=new o),o._INSTANCE}constructor(){this._data=WR()}getGraphemeBreakType(r){if(r<32)return r===10?3:r===13?2:4;if(r<127)return 0;let e=this._data,t=e.length/3,n=1;for(;n<=t;)if(r<e[3*n])n=2*n;else if(r>e[3*n+1])n=2*n+1;else return e[3*n+2];return 0}};VS=class o{constructor(r){this.confusableDictionary=r}static{this.ambiguousCharacterData=new xr(()=>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 Jp(r=>{let e=r.split(",");function t(u){let f=new Map;for(let m=0;m<u.length;m+=2)f.set(u[m],u[m+1]);return f}function n(u,f){let m=new Map(u);for(let[y,v]of f)m.set(y,v);return m}function i(u,f){if(!u)return f;let m=new Map;for(let[y,v]of u)f.has(y)&&m.set(y,v);return m}let s=this.ambiguousCharacterData.value,a=e.filter(u=>!u.startsWith("_")&&Object.hasOwn(s,u));a.length===0&&(a=["_default"]);let l;for(let u of a){let f=t(s[u]);l=i(l,f)}let c=t(s._common),d=n(c,l);return new o(d)})}static getInstance(r){return o.cache.get(Array.from(r).join(","))}static{this._locales=new xr(()=>Object.keys(o.ambiguousCharacterData.value).filter(r=>!r.startsWith("_")))}static getLocales(){return o._locales.value}isAmbiguous(r){return this.confusableDictionary.has(r)}containsAmbiguousCharacter(r){for(let e=0;e<r.length;e++){let t=r.codePointAt(e);if(typeof t=="number"&&this.isAmbiguous(t))return!0}return!1}getPrimaryConfusable(r){return this.confusableDictionary.get(r)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},HS=class o{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(o.getRawData())].flat())),this._data}static isInvisibleCharacter(r){return o.getData().has(r)}static containsInvisibleCharacter(r){for(let e=0;e<r.length;e++){let t=r.codePointAt(e);if(typeof t=="number"&&(o.isInvisibleCharacter(t)||t===32))return!0}return!1}static get codePoints(){return o.getData()}}});function To(o){return o===47||o===92}function fi(o){return o.replace(/[\\/]/g,ue.sep)}function GS(o){return o.indexOf("/")===-1&&(o=fi(o)),/^[a-zA-Z]:(\/|$)/.test(o)&&(o="/"+o),o}function wv(o,r=ue.sep){if(!o)return"";let e=o.length,t=o.charCodeAt(0);if(To(t)){if(To(o.charCodeAt(1))&&!To(o.charCodeAt(2))){let i=3,s=i;for(;i<e&&!To(o.charCodeAt(i));i++);if(s!==i&&!To(o.charCodeAt(i+1))){for(i+=1;i<e;i++)if(To(o.charCodeAt(i)))return o.slice(0,i+1).replace(/[\\/]/g,r)}}return r}else if(Yp(t)&&o.charCodeAt(1)===58)return To(o.charCodeAt(2))?o.slice(0,2)+r:o.slice(0,2);let n=o.indexOf("://");if(n!==-1){for(n+=3;n<e;n++)if(To(o.charCodeAt(n)))return o.slice(0,n+1)}return""}function jS(o){if(!M||!o||o.length<5)return!1;let r=o.charCodeAt(0);if(r!==92||(r=o.charCodeAt(1),r!==92))return!1;let e=2,t=e;for(;e<o.length&&(r=o.charCodeAt(e),r!==92);e++);return!(t===e||(r=o.charCodeAt(e+1),isNaN(r)||r===92))}function JS(o,r=M){let e=r?LR:AR;return!(!o||o.length===0||/^\s+$/.test(o)||(e.lastIndex=0,e.test(o))||r&&MR.test(o)||o==="."||o===".."||r&&o[o.length-1]==="."||r&&o.length!==o.trim().length||o.length>255)}function Co(o,r,e){let t=o===r;return!e||t?t:!o||!r?!1:Hr(o,r)}function $i(o,r,e,t=Bt){if(o===r)return!0;if(!o||!r||r.length>o.length)return!1;if(e){if(!Eo(o,r))return!1;if(r.length===o.length)return!0;let i=r.length;return r.charAt(r.length-1)===t&&i--,o.charAt(i)===t}return r.charAt(r.length-1)!==t&&(r+=t),o.indexOf(r)===0}function Yp(o){return o>=65&&o<=90||o>=97&&o<=122}function Zp(o,r){return M&&o.endsWith(":")&&(o+=Bt),bo(o)||(o=U(r,o)),o=kt(o),Iv(o)}function Iv(o){return M?(o=$n(o,Bt),o.endsWith(":")&&(o+=Bt)):(o=$n(o,Bt),o||(o=Bt)),o}function bv(o){let r=kt(o);return M?o.length>3?!1:Sv(r)&&(o.length===2||r.charCodeAt(2)===92):r===ue.sep}function Sv(o,r=M){return r?Yp(o.charCodeAt(0))&&o.charCodeAt(1)===58:!1}function La(o){let r=o.split(":"),e,t,n;for(let i of r){let s=Number(i);Hn(s)?t===void 0?t=s:n===void 0&&(n=s):e=e?[e,i].join(":"):i}if(!e)throw new Error("Format for `--goto` should be: `FILE:LINE(:COLUMN)`");return{path:e,line:t!==void 0?t:void 0,column:n!==void 0?n:t!==void 0?1:void 0}}function Ts(o,r,e=8){let t="";for(let i=0;i<e;i++){let s;i===0&&M&&!r&&(e===3||e===4)?s=FR:s=OR,t+=s.charAt(Math.floor(Math.random()*s.length))}let n;return r?n=`${r}-${t}`:n=t,o?U(o,n):n}var LR,AR,MR,OR,FR,an=w(()=>{Kn();Se();Y();dr();We();LR=/[\\/:\*\?"<>\|]/g,AR=/[/]/g,MR=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;OR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",FR="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789"});var ef=w(()=>{});function HR(o,r){if(!o.scheme&&r)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${o.authority}", path: "${o.path}", query: "${o.query}", fragment: "${o.fragment}"}`);if(o.scheme&&!NR.test(o.scheme)){let e=[...o.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:${o.scheme.length})`)}if(o.path){if(o.authority){if(!BR.test(o.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(VR.test(o.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function KR(o,r){return!o&&!r?"file":o}function $R(o,r){switch(o){case"https":case"http":case"file":r?r[0]!==qn&&(r=qn+r):r=qn;break}return r}function QS(o,r,e){let t,n=-1;for(let i=0;i<o.length;i++){let s=o.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||r&&s===47||e&&s===91||e&&s===93||e&&s===58)n!==-1&&(t+=encodeURIComponent(o.substring(n,i)),n=-1),t!==void 0&&(t+=o.charAt(i));else{t===void 0&&(t=o.substr(0,i));let a=e1[s];a!==void 0?(n!==-1&&(t+=encodeURIComponent(o.substring(n,i)),n=-1),t+=a):n===-1&&(n=i)}}return n!==-1&&(t+=encodeURIComponent(o.substring(n))),t!==void 0?t:o}function zR(o){let r;for(let e=0;e<o.length;e++){let t=o.charCodeAt(e);t===35||t===63?(r===void 0&&(r=o.substr(0,e)),r+=e1[t]):r!==void 0&&(r+=o[e])}return r!==void 0?r:o}function fd(o,r){let e;return o.authority&&o.path.length>1&&o.scheme==="file"?e=`//${o.authority}${o.path}`:o.path.charCodeAt(0)===47&&(o.path.charCodeAt(1)>=65&&o.path.charCodeAt(1)<=90||o.path.charCodeAt(1)>=97&&o.path.charCodeAt(1)<=122)&&o.path.charCodeAt(2)===58?r?e=o.path.substr(1):e=o.path[1].toLowerCase()+o.path.substr(2):e=o.path,M&&(e=e.replace(/\//g,"\\")),e}function xv(o,r){let e=r?zR:QS,t="",{scheme:n,authority:i,path:s,query:a,fragment:l}=o;if(n&&(t+=n,t+=":"),(i||n==="file")&&(t+=qn,t+=qn),i){let c=i.indexOf("@");if(c!==-1){let d=i.substr(0,c);i=i.substr(c+1),c=d.lastIndexOf(":"),c===-1?t+=e(d,!1,!1):(t+=e(d.substr(0,c),!1,!1),t+=":",t+=e(d.substr(c+1),!1,!0)),t+="@"}i=i.toLowerCase(),c=i.lastIndexOf(":"),c===-1?t+=e(i,!1,!0):(t+=e(i.substr(0,c),!1,!0),t+=i.substr(c))}if(s){if(s.length>=3&&s.charCodeAt(0)===47&&s.charCodeAt(2)===58){let c=s.charCodeAt(1);c>=65&&c<=90&&(s=`/${String.fromCharCode(c+32)}:${s.substr(3)}`)}else if(s.length>=2&&s.charCodeAt(1)===58){let c=s.charCodeAt(0);c>=65&&c<=90&&(s=`${String.fromCharCode(c+32)}:${s.substr(2)}`)}t+=e(s,!0,!1)}return a&&(t+="?",t+=e(a,!1,!1)),l&&(t+="#",t+=r?l:QS(l,!1,!1)),t}function t1(o){try{return decodeURIComponent(o)}catch{return o.length>3?o.substr(0,3)+t1(o.substr(3)):o}}function tf(o){return o.match(XS)?o.replace(XS,r=>t1(r)):o}var NR,BR,VR,vt,qn,qR,b,ZS,_o,e1,XS,se=w(()=>{Kn();ef();Se();Y();NR=/^\w[\w\d+.-]*$/,BR=/^\//,VR=/^\/\//;vt="",qn="/",qR=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,b=class o{static isUri(r){return r instanceof o?!0:!r||typeof r!="object"?!1:typeof r.authority=="string"&&typeof r.fragment=="string"&&typeof r.path=="string"&&typeof r.query=="string"&&typeof r.scheme=="string"&&typeof r.fsPath=="string"&&typeof r.with=="function"&&typeof r.toString=="function"}constructor(r,e,t,n,i,s=!1){typeof r=="object"?(this.scheme=r.scheme||vt,this.authority=r.authority||vt,this.path=r.path||vt,this.query=r.query||vt,this.fragment=r.fragment||vt):(this.scheme=KR(r,s),this.authority=e||vt,this.path=$R(this.scheme,t||vt),this.query=n||vt,this.fragment=i||vt,HR(this,s))}get fsPath(){return fd(this,!1)}with(r){if(!r)return this;let{scheme:e,authority:t,path:n,query:i,fragment:s}=r;return e===void 0?e=this.scheme:e===null&&(e=vt),t===void 0?t=this.authority:t===null&&(t=vt),n===void 0?n=this.path:n===null&&(n=vt),i===void 0?i=this.query:i===null&&(i=vt),s===void 0?s=this.fragment:s===null&&(s=vt),e===this.scheme&&t===this.authority&&n===this.path&&i===this.query&&s===this.fragment?this:new _o(e,t,n,i,s)}static parse(r,e=!1){let t=qR.exec(r);return t?new _o(t[2]||vt,tf(t[4]||vt),tf(t[5]||vt),tf(t[7]||vt),tf(t[9]||vt),e):new _o(vt,vt,vt,vt,vt)}static file(r){let e=vt;if(M&&(r=r.replace(/\\/g,qn)),r[0]===qn&&r[1]===qn){let t=r.indexOf(qn,2);t===-1?(e=r.substring(2),r=qn):(e=r.substring(2,t),r=r.substring(t)||qn)}return new _o("file",e,r,vt,vt)}static from(r,e){return new _o(r.scheme,r.authority,r.path,r.query,r.fragment,e)}static joinPath(r,...e){if(!r.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let t;return M&&r.scheme==="file"?t=o.file(ut.join(fd(r,!0),...e)).path:t=ue.join(r.path,...e),r.with({path:t})}toString(r=!1){return xv(this,r)}toJSON(){return this}static revive(r){if(r){if(r instanceof o)return r;{let e=new _o(r);return e._formatted=r.external??null,e._fsPath=r._sep===ZS?r.fsPath??null:null,e}}else return r}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}},ZS=M?1:void 0,_o=class extends b{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=fd(this,!1)),this._fsPath}toString(e=!1){return e?xv(this,!0):(this._formatted||(this._formatted=xv(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=ZS),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}},e1={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"};XS=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function GR(o,r){return b.isUri(o)?Hr(o.scheme,r):Eo(o,r+":")}function Tv(o,...r){return r.some(e=>GR(o,e))}function JR(o){return`${o.quality??"oss"}-${o.commit??"dev"}`}var N,jR,Pv,Cv,Aa,Ev,et,r1,n1,Ma,ze=w(()=>{Ve();Y();dr();se();Se();(pe=>(pe.inMemory="inmemory",pe.vscode="vscode",pe.internal="private",pe.walkThrough="walkThrough",pe.walkThroughSnippet="walkThroughSnippet",pe.http="http",pe.https="https",pe.file="file",pe.mailto="mailto",pe.untitled="untitled",pe.data="data",pe.command="command",pe.vscodeRemote="vscode-remote",pe.vscodeRemoteResource="vscode-remote-resource",pe.vscodeManagedRemoteResource="vscode-managed-remote-resource",pe.vscodeUserData="vscode-userdata",pe.vscodeCustomEditor="vscode-custom-editor",pe.vscodeNotebookCell="vscode-notebook-cell",pe.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",pe.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",pe.vscodeNotebookCellOutput="vscode-notebook-cell-output",pe.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",pe.vscodeNotebookMetadata="vscode-notebook-metadata",pe.vscodeInteractiveInput="vscode-interactive-input",pe.vscodeSettings="vscode-settings",pe.vscodeWorkspaceTrust="vscode-workspace-trust",pe.vscodeTerminal="vscode-terminal",pe.vscodeChatCodeBlock="vscode-chat-code-block",pe.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",pe.vscodeChatEditor="vscode-chat-editor",pe.vscodeChatInput="chatSessionInput",pe.vscodeLocalChatSession="vscode-chat-session",pe.webviewPanel="webview-panel",pe.vscodeWebview="vscode-webview",pe.vscodeBrowser="vscode-browser",pe.extension="extension",pe.vscodeFileResource="vscode-file",pe.tmp="tmp",pe.vsls="vsls",pe.vscodeSourceControl="vscode-scm",pe.commentsInput="comment",pe.codeSetting="code-setting",pe.outputChannel="output",pe.accessibleView="accessible-view",pe.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",pe.chatEditingModel="chat-editing-text-model",pe.copilotPr="copilot-pr"))(N||={});jR="tkn",Pv=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(r){this._preferredWebSchema=r}setDelegate(r){this._delegate=r}setServerRootPath(r,e){this._serverRootPath=ue.join(e??"/",JR(r))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return ue.join(this._serverRootPath,N.vscodeRemoteResource)}set(r,e,t){this._hosts[r]=e,this._ports[r]=t}setConnectionToken(r,e){this._connectionTokens[r]=e}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(r){if(this._delegate)try{return this._delegate(r)}catch(a){return rt(a),r}let e=r.authority,t=this._hosts[e];t&&t.indexOf(":")!==-1&&t.indexOf("[")===-1&&(t=`[${t}]`);let n=this._ports[e],i=this._connectionTokens[e],s=`path=${encodeURIComponent(r.path)}`;return typeof i=="string"&&(s+=`&${jR}=${encodeURIComponent(i)}`),b.from({scheme:Dr?this._preferredWebSchema:N.vscodeRemoteResource,authority:`${t}:${n}`,path:this._remoteResourcesPath,query:s})}},Cv=new Pv;Aa="vscode-app",Ev=class o{static{this.FALLBACK_AUTHORITY=Aa}asBrowserUri(r){let e=this.toUri(r);return this.uriToBrowserUri(e)}uriToBrowserUri(r){return r.scheme===N.vscodeRemote?Cv.rewrite(r):r.scheme===N.file&&(Wp||Jb===`${N.vscodeFileResource}://${o.FALLBACK_AUTHORITY}`)?r.with({scheme:N.vscodeFileResource,authority:r.authority||o.FALLBACK_AUTHORITY,query:null,fragment:null}):r}asFileUri(r){let e=this.toUri(r);return this.uriToFileUri(e)}uriToFileUri(r){return r.scheme===N.vscodeFileResource?r.with({scheme:N.file,authority:r.authority!==o.FALLBACK_AUTHORITY?r.authority:null,query:null,fragment:null}):r}toUri(r){if(b.isUri(r))return r;if(globalThis._VSCODE_FILE_ROOT){let e=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(e))return b.joinPath(b.parse(e,!0),r);let t=U(e,r);return b.file(t)}throw new Error("Cannot determine URI for module id!")}},et=new Ev,r1=Object.freeze({"Cache-Control":"no-cache, no-store"}),n1=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"});(i=>{let o=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);i.CoopAndCoep=Object.freeze(o.get("3"));let e="vscode-coi";function t(s){let a;typeof s=="string"?a=new URL(s).searchParams:s instanceof URL?a=s.searchParams:b.isUri(s)&&(a=new URL(s.toString(!0)).searchParams);let l=a?.get(e);if(l)return o.get(l)}i.getHeadersFromQuery=t;function n(s,a,l){if(!globalThis.crossOriginIsolated)return;let c=a&&l?"3":l?"2":"1";s instanceof URLSearchParams?s.set(e,c):s[e]=c}i.addSearchParam=n})(Ma||={})});function ur(o){return fd(o,!0)}var Cs,Me,Ge,Oa,md,_v,i4,QR,Kr,o1,s1,fe,rf,o4,s4,a1,Ar,i1,Fa,a4,XR,yt=w(()=>{Kn();an();ze();Se();Y();dr();se();Cs=class{constructor(r){this._ignorePathCasing=r}compare(r,e,t=!1){return r===e?0:ud(this.getComparisonKey(r,t),this.getComparisonKey(e,t))}isEqual(r,e,t=!1){return r===e?!0:!r||!e?!1:this.getComparisonKey(r,t)===this.getComparisonKey(e,t)}getComparisonKey(r,e=!1){return r.with({path:this._ignorePathCasing(r)?r.path.toLowerCase():void 0,fragment:e?null:void 0}).toString()}ignorePathCasing(r){return this._ignorePathCasing(r)}isEqualOrParent(r,e,t=!1){if(r.scheme===e.scheme){if(r.scheme===N.file)return $i(ur(r),ur(e),this._ignorePathCasing(r))&&r.query===e.query&&(t||r.fragment===e.fragment);if(Ar(r.authority,e.authority))return $i(r.path,e.path,this._ignorePathCasing(r),"/")&&r.query===e.query&&(t||r.fragment===e.fragment)}return!1}joinPath(r,...e){return b.joinPath(r,...e)}basenameOrAuthority(r){return Kr(r)||r.authority}basename(r){return ue.basename(r.path)}extname(r){return ue.extname(r.path)}dirname(r){if(r.path.length===0)return r;let e;return r.scheme===N.file?e=b.file($e(ur(r))).path:(e=ue.dirname(r.path),r.authority&&e.length&&e.charCodeAt(0)!==47&&(console.error(`dirname("${r.toString})) resulted in a relative path`),e="/")),r.with({path:e})}normalizePath(r){if(!r.path.length)return r;let e;return r.scheme===N.file?e=b.file(kt(ur(r))).path:e=ue.normalize(r.path),r.with({path:e})}relativePath(r,e){if(r.scheme!==e.scheme||!Ar(r.authority,e.authority))return;if(r.scheme===N.file){let i=Op(ur(r),ur(e));return M?fi(i):i}let t=r.path||"/",n=e.path||"/";if(this._ignorePathCasing(r)){let i=0;for(let s=Math.min(t.length,n.length);i<s&&!(t.charCodeAt(i)!==n.charCodeAt(i)&&t.charAt(i).toLowerCase()!==n.charAt(i).toLowerCase());i++);t=n.substr(0,i)+t.substr(i)}return ue.relative(t,n)}resolvePath(r,e){if(r.scheme===N.file){let t=b.file(It(ur(r),e));return r.with({authority:t.authority,path:t.path})}return e=GS(e),r.with({path:ue.resolve(r.path,e)})}isAbsolutePath(r){return!!r.path&&r.path[0]==="/"}isEqualAuthority(r,e){return r===e||r!==void 0&&e!==void 0&&Hr(r,e)}hasTrailingPathSeparator(r,e=Bt){if(r.scheme===N.file){let t=ur(r);return t.length>wv(t).length&&t[t.length-1]===e}else{let t=r.path;return t.length>1&&t.charCodeAt(t.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(r.fsPath)}}removeTrailingPathSeparator(r,e=Bt){return i1(r,e)?r.with({path:r.path.substr(0,r.path.length-1)}):r}addTrailingPathSeparator(r,e=Bt){let t=!1;if(r.scheme===N.file){let n=ur(r);t=n!==void 0&&n.length===wv(n).length&&n[n.length-1]===e}else{e="/";let n=r.path;t=n.length===1&&n.charCodeAt(n.length-1)===47}return!t&&!i1(r,e)?r.with({path:r.path+"/"}):r}},Me=new Cs(()=>!1),Ge=new Cs(o=>o.scheme===N.file?!ne:!0),Oa=new Cs(o=>!0),md=Me.isEqual.bind(Me),_v=Me.isEqualOrParent.bind(Me),i4=Me.getComparisonKey.bind(Me),QR=Me.basenameOrAuthority.bind(Me),Kr=Me.basename.bind(Me),o1=Me.extname.bind(Me),s1=Me.dirname.bind(Me),fe=Me.joinPath.bind(Me),rf=Me.normalizePath.bind(Me),o4=Me.relativePath.bind(Me),s4=Me.resolvePath.bind(Me),a1=Me.isAbsolutePath.bind(Me),Ar=Me.isEqualAuthority.bind(Me),i1=Me.hasTrailingPathSeparator.bind(Me),Fa=Me.removeTrailingPathSeparator.bind(Me),a4=Me.addTrailingPathSeparator.bind(Me);(i=>{i.META_DATA_LABEL="label",i.META_DATA_DESCRIPTION="description",i.META_DATA_SIZE="size",i.META_DATA_MIME="mime";function n(s){let a=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(d=>{let[u,f]=d.split(":");u&&f&&a.set(u,f)});let c=s.path.substring(0,s.path.indexOf(";"));return c&&a.set(i.META_DATA_MIME,c),a}i.parseMetaData=n})(XR||={})});var l1,c1=w(()=>{l1=Symbol("MicrotaskDelay")});function cf(o){return!!o&&typeof o.then=="function"}function zn(o){let r=new qe,e=o(r.token),t=!1,n=new Promise((i,s)=>{let a=r.token.onCancellationRequested(()=>{t=!0,a.dispose(),s(new Et)});Promise.resolve(e).then(l=>{a.dispose(),r.dispose(),t?Gp(l)&&l.dispose():i(l)},l=>{a.dispose(),r.dispose(),s(l)})});return new class{cancel(){r.cancel(),r.dispose()}then(i,s){return n.then(i,s)}catch(i){return this.then(void 0,i)}finally(i){return n.finally(i)}}}function Dv(o,r,e){let t,n=setTimeout(()=>{t?.(void 0),e?.()},r);return Promise.race([o.finally(()=>clearTimeout(n)),new Promise(i=>t=i)])}function p1(){let o,r;return{promise:new Promise((t,n)=>{o=t,r=n}),resolve:o,reject:r}}function lt(o,r){return r?new Promise((e,t)=>{let n=setTimeout(()=>{i.dispose(),e()},o),i=r.onCancellationRequested(()=>{clearTimeout(n),i.dispose(),t(new Et)})}):zn(e=>lt(o,e))}function df(o,r=0,e){let t=setTimeout(()=>{o(),e&&n.dispose()},r),n=j(()=>{clearTimeout(t),e?.delete(n)});return e?.add(n),n}function f1(o,r=t=>!!t,e=null){let t=0,n=o.length,i=()=>{if(t>=n)return Promise.resolve(e);let s=o[t++];return Promise.resolve(s()).then(l=>r(l)?Promise.resolve(l):i())};return i()}async function m1(o,r,e){let t;for(let n=0;n<e;n++)try{return await o()}catch(i){t=i,await lt(r)}throw t}var hd,YR,ZR,_s,Pr,mi,gd,Cn,Ua,vd,of,pr,sf,af,Na,yd,nf,kv,lf,Gt,wt,d1,Rv,u1,he=w(()=>{St();Ve();Q();K();yt();Y();c1();xo();hd=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null,this.cancellationTokenSource=new qe}queue(r){if(this.cancellationTokenSource.token.isCancellationRequested)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=r,!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=r(this.cancellationTokenSource.token),new Promise((e,t)=>{this.activePromise.then(n=>{this.activePromise=null,e(n)},n=>{this.activePromise=null,t(n)})})}dispose(){this.cancellationTokenSource.cancel()}},YR=(o,r)=>{let e=!0,t=setTimeout(()=>{e=!1,r()},o);return{isTriggered:()=>e,dispose:()=>{clearTimeout(t),e=!1}}},ZR=o=>{let r=!0;return queueMicrotask(()=>{r&&(r=!1,o())}),{isTriggered:()=>r,dispose:()=>{r=!1}}},_s=class{constructor(r){this.defaultDelay=r;this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(r,e=this.defaultDelay){this.task=r,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((n,i)=>{this.doResolve=n,this.doReject=i}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let n=this.task;return this.task=null,n()}}));let t=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=e===l1?ZR(t):YR(e,t),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new Et),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},Pr=class{constructor(r){this.delayer=new _s(r),this.throttler=new hd}trigger(r,e){return this.delayer.trigger(()=>this.throttler.queue(r),e)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}},mi=class{constructor(){this._isOpen=!1,this._promise=new Promise((r,e)=>{this._completePromise=r})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}};gd=class{constructor(r){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=r,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new x}whenIdle(){return this.size>0?E.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(r){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((e,t)=>{this.outstandingPromises.push({factory:r,c:e,e:t}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){let r=this.outstandingPromises.shift();this.runningPromises++;let e=r.factory();e.then(r.c,r.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()}},Cn=class extends gd{constructor(){super(1)}},Ua=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let r=new Gt;return this.drainers.add(r),r.p}isDrained(){for(let[,r]of this.queues)if(r.size>0)return!1;return!0}queueSize(r,e=Me){let t=e.getComparisonKey(r);return this.queues.get(t)?.size??0}queueFor(r,e,t=Me){let n=t.getComparisonKey(r),i=this.queues.get(n);if(!i){i=new Cn;let s=this.drainListenerCount++,a=E.once(i.onDrained)(()=>{i?.dispose(),this.queues.delete(n),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(s),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new cr),this.drainListeners.set(s,a),this.queues.set(n,i)}return i.queue(e)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let r of this.drainers)r.complete();this.drainers.clear()}dispose(){for(let[,r]of this.queues)r.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}},vd=class{constructor(r,e){this._isDisposed=!1;this._token=void 0,typeof r=="function"&&typeof e=="number"&&this.setIfNotSet(r,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==void 0&&(clearTimeout(this._token),this._token=void 0)}cancelAndSet(r,e){if(this._isDisposed)throw new Vn("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=void 0,r()},e)}setIfNotSet(r,e){if(this._isDisposed)throw new Vn("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,r()},e))}},of=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(r,e,t=globalThis){if(this.isDisposed)throw new Vn("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=t.setInterval(()=>{r()},e);this.disposable=j(()=>{t.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},pr=class{constructor(r,e){this.timeoutToken=void 0,this.runner=r,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(r=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,r)}get delay(){return this.timeout}set delay(r){this.timeout=r}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?.()}},sf=class{constructor(r,e){e%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.runner=r,this.timeout=e,this.counter=0,this.intervalToken=void 0,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=void 0)}schedule(r=this.timeout){r%1e3!==0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${r}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(r/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return this.intervalToken!==void 0}onInterval(){this.counter--,!(this.counter>0)&&(clearInterval(this.intervalToken),this.intervalToken=void 0,this.runner?.())}},af=class extends pr{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()}},Na=class extends C{constructor(e,t){super();this.options=e;this.handler=t;this.pendingWork=[];this.throttler=this._register(new er);this.disposed=!1;this.lastExecutionTime=0}get pending(){return this.pendingWork.length}work(e){if(this.disposed)return!1;if(typeof this.options.maxBufferedWork=="number"){if(this.throttler.value){if(this.pending+e.length>this.options.maxBufferedWork)return!1}else if(this.pending+e.length-this.options.maxWorkChunkSize>this.options.maxBufferedWork)return!1}for(let n of e)this.pendingWork.push(n);let t=Date.now()-this.lastExecutionTime;return!this.throttler.value&&(!this.options.waitThrottleDelayBetweenWorkUnits||t>=this.options.throttleDelay)?this.doWork():!this.throttler.value&&this.options.waitThrottleDelayBetweenWorkUnits&&this.scheduleThrottler(Math.max(this.options.throttleDelay-t,0)),!0}doWork(){this.lastExecutionTime=Date.now(),this.handler(this.pendingWork.splice(0,this.options.maxWorkChunkSize)),this.pendingWork.length>0&&this.scheduleThrottler()}scheduleThrottler(e=this.options.throttleDelay){this.throttler.value=new pr(()=>{this.throttler.clear(),this.doWork()},e),this.throttler.value.schedule()}dispose(){super.dispose(),this.pendingWork.length=0,this.disposed=!0}};(function(){let o=globalThis;typeof o.requestIdleCallback!="function"||typeof o.cancelIdleCallback!="function"?nf=(r,e,t)=>{Xb(()=>{if(n)return;let i=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let n=!1;return{dispose(){n||(n=!0)}}}:nf=(r,e,t)=>{let n=r.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0),i=!1;return{dispose(){i||(i=!0,r.cancelIdleCallback(n))}}},yd=(r,e)=>nf(globalThis,r,e)})();kv=class{constructor(r,e){this._didRun=!1;this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=nf(r,()=>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}},lf=class extends kv{constructor(r){super(globalThis,r)}};Gt=class o{static fromPromise(r){let e=new o;return e.settleWith(r),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((r,e)=>{this.completeCallback=r,this.errorCallback=e})}complete(r){return this.isSettled?Promise.resolve():new Promise(e=>{this.completeCallback(r),this.outcome={outcome:0,value:r},e()})}error(r){return this.isSettled?Promise.resolve():new Promise(e=>{this.errorCallback(r),this.outcome={outcome:1,value:r},e()})}settleWith(r){return r.then(e=>this.complete(e),e=>this.error(e))}cancel(){return this.error(new Et)}};(e=>{async function o(t){let n,i=await Promise.all(t.map(s=>s.then(a=>a,a=>{n||(n=a)})));if(typeof n<"u")throw n;return i}e.settled=o;function r(t){return new Promise(async(n,i)=>{try{await t(n,i)}catch(s){i(s)}})}e.withAsyncBody=r})(wt||={});d1=class o{static fromArray(r){return new o(e=>{e.emitMany(r)})}static fromPromise(r){return new o(async e=>{e.emitMany(await r)})}static fromPromisesResolveOrder(r){return new o(async e=>{await Promise.all(r.map(async t=>e.emitOne(await t)))})}static merge(r){return new o(async e=>{await Promise.all(r.map(async t=>{for await(let n of t)e.emitOne(n)}))})}static{this.EMPTY=o.fromArray([])}constructor(r,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new x,queueMicrotask(async()=>{let t={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(r(t)),this.resolve()}catch(n){this.reject(n)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let r=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(r<this._results.length)return{done:!1,value:this._results[r++]};if(this._state===1)return{done:!0,value:void 0};await E.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(r,e){return new o(async t=>{for await(let n of r)t.emitOne(e(n))})}map(r){return o.map(this,r)}static filter(r,e){return new o(async t=>{for await(let n of r)e(n)&&t.emitOne(n)})}filter(r){return o.filter(this,r)}static coalesce(r){return o.filter(r,e=>!!e)}coalesce(){return o.coalesce(this)}static async toPromise(r){let e=[];for await(let t of r)e.push(t);return e}toPromise(){return o.toPromise(this)}emitOne(r){this._state===0&&(this._results.push(r),this._onStateChanged.fire())}emitMany(r){this._state===0&&(this._results=this._results.concat(r),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(r){this._state===0&&(this._state=2,this._error=r,this._onStateChanged.fire())}},Rv=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(r){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let e=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(e,r)}else this._unconsumedValues.push(r)}produceFinal(r){this._ensureNoFinalValue(),this._finalValue=r;for(let e of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(e,r);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new Vn("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(r,e){e.ok?r.complete(e.value):r.error(e.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let r=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return r.ok?Promise.resolve(r.value):Promise.reject(r.error)}else{let r=new Gt;return this._unsatisfiedConsumers.push(r),r.p}}},u1=class o{constructor(r,e){this._onReturn=e;this._producerConsumer=new Rv;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async r=>(this._finishError(r),{done:!0,value:void 0})};queueMicrotask(async()=>{let t=r({emitOne:n=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:n}}),emitMany:n=>{for(let i of n)this._producerConsumer.produce({ok:!0,value:{done:!1,value:i}})},reject:n=>this._finishError(n)});if(!this._producerConsumer.hasFinalValue)try{await t,this._finishOk()}catch(n){this._finishError(n)}})}static fromArray(r){return new o(e=>{e.emitMany(r)})}static fromPromise(r){return new o(async e=>{e.emitMany(await r)})}static fromPromisesResolveOrder(r){return new o(async e=>{await Promise.all(r.map(async t=>e.emitOne(await t)))})}static merge(r){return new o(async e=>{await Promise.all(r.map(async t=>{for await(let n of t)e.emitOne(n)}))})}static{this.EMPTY=o.fromArray([])}static map(r,e){return new o(async t=>{for await(let n of r)t.emitOne(e(n))})}static tee(r){let e,t,n=new Gt,i=async()=>{if(!(!e||!t))try{for await(let l of r)e.emitOne(l),t.emitOne(l)}catch(l){e.reject(l),t.reject(l)}finally{n.complete()}},s=new o(async l=>(e=l,i(),n.p)),a=new o(async l=>(t=l,i(),n.p));return[s,a]}map(r){return o.map(this,r)}static coalesce(r){return o.filter(r,e=>!!e)}coalesce(){return o.coalesce(this)}static filter(r,e){return new o(async t=>{for await(let n of r)e(n)&&t.emitOne(n)})}filter(r){return o.filter(this,r)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(r){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:r})}[Symbol.asyncIterator](){return this._iterator}}});function hi(o){return h1(o,"NFC",eD)}function rD(o){return h1(o,"NFD",tD)}function h1(o,r,e){if(!o)return o;let t=e.get(o);if(t)return t;let n;return nD.test(o)?n=o.normalize(r):n=o,e.set(o,n),n}var eD,tD,nD,E4,wd=w(()=>{Lr();eD=new di(1e4);tD=new di(1e4);nD=/[^\u0000-\u0080]/;E4=(function(){let o=new di(1e4),r=/[\u0300-\u036f]/g;return function(e){let t=o.get(e);if(t)return t;let n=rD(e).replace(r,""),i=(n.length===e.length?n:e).toLowerCase();return o.set(e,i),i}})()});import*as we from"fs";import{tmpdir as iD}from"os";import{promisify as Id}from"util";async function y1(o,r=0,e){if(bv(o))throw new Error("rimraf - will refuse to recursively delete root");return r===0?Wv(o):oD(o,e)}async function oD(o,r=Ts(iD())){try{try{await we.promises.rename(o,r)}catch(e){return e.code==="ENOENT"?void 0:Wv(o)}Wv(r).catch(()=>{})}catch(e){if(e.code!=="ENOENT")throw e}}async function Wv(o){return we.promises.rm(o,{recursive:!0,force:!0,maxRetries:3})}async function uf(o,r){try{return await g1(o,r)}catch(e){if(e.code==="ENOENT"&&M&&bv(o))try{return await g1(`${o}.`,r)}catch{}throw e}}async function g1(o,r){return aD(await(r?sD(o):we.promises.readdir(o)))}async function sD(o){try{return await we.promises.readdir(o,{withFileTypes:!0})}catch(t){t.code!=="ENOENT"&&console.warn("[node.js fs] readdir with filetypes failed with error: ",t)}let r=[],e=await uf(o);for(let t of e){let n=!1,i=!1,s=!1;try{let a=await we.promises.lstat(U(o,t));n=a.isFile(),i=a.isDirectory(),s=a.isSymbolicLink()}catch(a){a.code!=="ENOENT"&&console.warn("[node.js fs] unexpected error from lstat after readdir: ",a)}r.push({name:t,isFile:()=>n,isDirectory:()=>i,isSymbolicLink:()=>s})}return r}function aD(o){return o.map(r=>typeof r=="string"?V?hi(r):r:(r.name=V?hi(r.name):r.name,r))}async function lD(o){let r=await uf(o),e=[];for(let t of r)await Yt.existsDirectory(U(o,t))&&e.push(t);return e}function w1(o,r=1e3){return new Promise(e=>{let t=!1,n=setInterval(()=>{t||(t=!0,we.access(o,i=>{t=!1,i&&(clearInterval(n),e(void 0))}))},r)})}function dD(o,r,e){return cD.queueFor(b.file(o),()=>{let t=fD(e);return new Promise((n,i)=>pD(o,r,t,s=>s?i(s):n()))},Ge)}function uD(o){I1=o}function pD(o,r,e,t){if(!I1)return we.writeFile(o,r,{mode:e.mode,flag:e.flag},t);we.open(o,e.flag,e.mode,(n,i)=>{if(n)return t(n);we.writeFile(i,r,s=>{if(s)return we.close(i,()=>t(s));we.fdatasync(i,a=>(a&&(console.warn("[node.js fs] fdatasync is now disabled for this session because it failed: ",a),uD(!1)),we.close(i,l=>t(l))))})})}function fD(o){return o?{mode:typeof o.mode=="number"?o.mode:438,flag:typeof o.flag=="string"?o.flag:"w"}:{mode:438,flag:"w"}}async function mD(o,r,e=6e4){if(o!==r)try{M&&typeof e=="number"?await b1(o,r,Date.now(),e):await we.promises.rename(o,r)}catch(t){if(o.toLowerCase()!==r.toLowerCase()&&t.code==="EXDEV"||o.endsWith("."))await S1(o,r,{preserveSymlinks:!1}),await y1(o,1);else throw t}}async function b1(o,r,e,t,n=0){try{return await we.promises.rename(o,r)}catch(i){if(i.code!=="EACCES"&&i.code!=="EPERM"&&i.code!=="EBUSY")throw i;if(Date.now()-e>=t)throw console.error(`[node.js fs] rename failed after ${n} retries with error: ${i}`),i;if(n===0){let s=!1;try{let{stat:a}=await Yt.stat(r);a.isFile()||(s=!0)}catch{}if(s)throw i}return await lt(Math.min(100,n*10)),b1(o,r,e,t,n+1)}}async function S1(o,r,e){return x1(o,r,{root:{source:o,target:r},options:e,handledSourcePaths:new Set})}async function x1(o,r,e){if(e.handledSourcePaths.has(o))return;e.handledSourcePaths.add(o);let{stat:t,symbolicLink:n}=await Yt.stat(o);if(n){if(e.options.preserveSymlinks)try{return await vD(o,r,e)}catch{}if(n.dangling)return}return t.isDirectory()?hD(o,r,t.mode&v1,e):gD(o,r,t.mode&v1)}async function hD(o,r,e,t){await we.promises.mkdir(r,{recursive:!0,mode:e});let n=await uf(o);for(let i of n)await x1(U(o,i),U(r,i),t)}async function gD(o,r,e){await we.promises.copyFile(o,r),await we.promises.chmod(r,e)}async function vD(o,r,e){let t=await we.promises.readlink(o);$i(t,e.root.source,!ne)&&(t=U(e.root.target,t.substr(e.root.source.length+1))),await we.promises.symlink(t,r)}async function yD(o){try{return await Id(we.realpath)(o)}catch{let r=wD(o);return await we.promises.access(r,we.constants.R_OK),r}}function wD(o){return $n(kt(o),Bt)}var Yt,cD,I1,v1,q,jt=w(()=>{he();an();wd();Se();Y();yt();se();dr();(t=>{async function o(n){let i;try{if(i=await we.promises.lstat(n),!i.isSymbolicLink())return{stat:i}}catch{}try{return{stat:await we.promises.stat(n),symbolicLink:i?.isSymbolicLink()?{dangling:!1}:void 0}}catch(s){if(s.code==="ENOENT"&&i)return{stat:i,symbolicLink:{dangling:!0}};if(M&&s.code==="EACCES")try{return{stat:await we.promises.stat(await we.promises.readlink(n)),symbolicLink:{dangling:!1}}}catch(a){if(a.code==="ENOENT"&&i)return{stat:i,symbolicLink:{dangling:!0}};throw a}throw s}}t.stat=o;async function r(n){try{let{stat:i,symbolicLink:s}=await t.stat(n);return i.isFile()&&s?.dangling!==!0}catch{}return!1}t.existsFile=r;async function e(n){try{let{stat:i,symbolicLink:s}=await t.stat(n);return i.isDirectory()&&s?.dangling!==!0}catch{}return!1}t.existsDirectory=e})(Yt||={});cD=new Ua;I1=!0;v1=511;q=new class{get read(){return(o,r,e,t,n)=>new Promise((i,s)=>{we.read(o,r,e,t,n,(a,l,c)=>a?s(a):i({bytesRead:l,buffer:c}))})}get write(){return(o,r,e,t,n)=>new Promise((i,s)=>{we.write(o,r,e,t,n,(a,l,c)=>a?s(a):i({bytesWritten:l,buffer:c}))})}get fdatasync(){return Id(we.fdatasync)}get open(){return Id(we.open)}get close(){return Id(we.close)}get ftruncate(){return Id(we.ftruncate)}async exists(o){try{return await we.promises.access(o),!0}catch{return!1}}get readdir(){return uf}get readDirsInDir(){return lD}get writeFile(){return dD}get rm(){return y1}get rename(){return mD}get copy(){return S1}get realpath(){return yD}}});function P1(){let o=E1();return o?Array.from(o):[]}function E1(){return process.uncHostAllowlist}function zi(o){if(process.platform!=="win32")return;let r=E1();if(r)if(typeof o=="string")r.add(o.toLowerCase());else for(let e of xD(o))zi(e)}function xD(o){let r=new Set;if(Array.isArray(o))for(let e of o)typeof e=="string"&&r.add(e);return Array.from(r)}function pf(o){if(typeof o!="string")return;let r=["\\\\.\\UNC\\","\\\\?\\UNC\\","\\\\"],e;for(let t of r){if(o.indexOf(t)!==0)continue;let i=o.indexOf("\\",t.length);if(i===-1)continue;let s=o.substring(t.length,i);if(s){e=s;break}}return e}function T1(){process.platform==="win32"&&(process.restrictUNCAccess=!1)}function C1(){return process.platform!=="win32"?!0:process.restrictUNCAccess===!1}var Va=w(()=>{});var _1,q4,Sd=w(()=>{Ce();_1="/etc/vscode/policy.json",q4={Extensions:{name:{key:"extensionsConfigurationTitle",value:h(141,null)}},IntegratedTerminal:{name:{key:"terminalIntegratedConfigurationTitle",value:h(144,null)}},InteractiveSession:{name:{key:"interactiveSessionConfigurationTitle",value:h(142,null)}},Telemetry:{name:{key:"telemetryConfigurationTitle",value:h(143,null)}},Update:{name:{key:"updateConfigurationTitle",value:h(145,null)}}}});function PD(o,r,e){r[Gn.DI_TARGET]===r?r[Gn.DI_DEPENDENCIES].push({id:o,index:e}):(r[Gn.DI_DEPENDENCIES]=[{id:o,index:e}],r[Gn.DI_TARGET]=r)}function W(o){if(Gn.serviceIds.has(o))return Gn.serviceIds.get(o);let r=function(e,t,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");PD(r,e,n)};return r.toString=()=>o,Gn.serviceIds.set(o,r),r}var Gn,Vt,Z=w(()=>{(n=>{n.serviceIds=new Map,n.DI_TARGET="$di$target",n.DI_DEPENDENCIES="$di$dependencies";function t(i){return i[n.DI_DEPENDENCIES]||[]}n.getServiceDependencies=t})(Gn||={});Vt=W("instantiationService")});function ff(o){let r=o;return r&&typeof r=="object"&&(!r.overrideIdentifier||typeof r.overrideIdentifier=="string")&&(!r.resource||r.resource instanceof b)}function k1(o){let r=o;return r&&typeof r=="object"&&(!r.overrideIdentifiers||Array.isArray(r.overrideIdentifiers))&&!r.overrideIdentifier&&(!r.resource||r.resource instanceof b)}function mf(o,r){let e=Object.create(null);for(let t in o)Av(e,t,o[t],r);return e}function Av(o,r,e,t){let n=r.split("."),i=n.pop(),s=o;for(let a=0;a<n.length;a++){let l=n[a],c=s[l];switch(typeof c){case"undefined":c=s[l]=Object.create(null);break;case"object":if(c===null){t(`Ignoring ${r} as ${n.slice(0,a+1).join(".")} is null`);return}break;default:t(`Ignoring ${r} as ${n.slice(0,a+1).join(".")} is ${JSON.stringify(c)}`);return}s=c}if(typeof s=="object"&&s!==null)try{s[i]=e}catch{t(`Ignoring ${r} as ${n.join(".")} is ${JSON.stringify(s)}`)}else t(`Ignoring ${r} as ${n.join(".")} is ${JSON.stringify(s)}`)}function R1(o,r){let e=r.split(".");D1(o,e)}function D1(o,r){if(!o)return;let e=o,t=r.shift();if(r.length===0){delete e[t];return}if(Object.keys(e).indexOf(t)!==-1){let n=e[t];typeof n=="object"&&!Array.isArray(n)&&(D1(n,r),Object.keys(n).length===0&&delete e[t])}}function xd(o,r,e){function t(s,a){let l=s;for(let c of a){if(typeof l!="object"||l===null)return;l=l[c]}return l}let n=r.split("."),i=t(o,n);return typeof i>"u"?e:i}function W1(o){return o.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}var ge,st=w(()=>{Ca();We();se();Z();ge=W("configurationService")});function L1(o){let r=!1,e=new Map,t=new Map;if(ED(o,d=>{if(o===d)return!0;let u=JSON.stringify(d);if(u.length<30)return!0;let f=e.get(u);if(!f){let m={schemas:[d]};return e.set(u,m),t.set(d,m),!0}return f.schemas.push(d),t.set(d,f),r=!0,!1}),e.clear(),!r)return JSON.stringify(o);let i="$defs";for(;o.hasOwnProperty(i);)i+="_";let s=[];function a(d){return JSON.stringify(d,(u,f)=>{if(f!==d){let m=t.get(f);if(m&&m.schemas.length>1)return m.id||(m.id=`_${s.length}`,s.push(m.schemas[0])),{$ref:`#/${i}/${m.id}`}}return f})}let l=a(o),c=[];for(let d=0;d<s.length;d++)c.push(`"_${d}":${a(s[d])}`);return c.length?`${l.substring(0,l.length-1)},"${i}":{${c.join(",")}}}`:l}function Ha(o){return typeof o=="object"&&o!==null}function ED(o,r){if(!o||typeof o!="object")return;let e=(...l)=>{for(let c of l)Ha(c)&&s.push(c)},t=(...l)=>{for(let c of l)if(Ha(c))for(let d in c){let u=c[d];Ha(u)&&s.push(u)}},n=(...l)=>{for(let c of l)if(Array.isArray(c))for(let d of c)Ha(d)&&s.push(d)},i=l=>{if(Array.isArray(l))for(let c of l)Ha(c)&&s.push(c);else Ha(l)&&s.push(l)},s=[o],a=s.pop();for(;a;)r(a)&&(e(a.additionalItems,a.additionalProperties,a.not,a.contains,a.propertyNames,a.if,a.then,a.else,a.unevaluatedItems,a.unevaluatedProperties),t(a.definitions,a.$defs,a.properties,a.patternProperties,a.dependencies,a.dependentSchemas),n(a.anyOf,a.allOf,a.oneOf,a.prefixItems),i(a.items)),a=s.pop()}var A1=w(()=>{});var Mv,Tt,jn=w(()=>{Ca();We();Mv=class{constructor(){this.data=new Map}add(r,e){$p(Ae(r)),$p(Je(e)),$p(!this.data.has(r),"There is already an extension with this id"),this.data.set(r,e)}knows(r){return this.data.has(r)}as(r){return this.data.get(r)||null}dispose(){this.data.forEach(r=>{od(r.dispose)&&r.dispose()}),this.data.clear()}},Tt=new Mv});function M1(o){return o.length>0&&o.charAt(o.length-1)==="#"?o.substring(0,o.length-1):o}var Fv,Ov,CD,O1=w(()=>{Q();A1();K();jn();Fv={JSONContribution:"base.contributions.json"};Ov=class extends C{constructor(){super(...arguments);this.schemasById={};this.schemaAssociations={};this._onDidChangeSchema=this._register(new x);this.onDidChangeSchema=this._onDidChangeSchema.event;this._onDidChangeSchemaAssociations=this._register(new x);this.onDidChangeSchemaAssociations=this._onDidChangeSchemaAssociations.event}registerSchema(e,t,n){let i=M1(e);this.schemasById[i]=t,this._onDidChangeSchema.fire(e),n&&n.add(j(()=>{delete this.schemasById[i],this._onDidChangeSchema.fire(e)}))}registerSchemaAssociation(e,t){let n=M1(e);return this.schemaAssociations[n]||(this.schemaAssociations[n]=[]),this.schemaAssociations[n].includes(t)||(this.schemaAssociations[n].push(t),this._onDidChangeSchemaAssociations.fire()),j(()=>{let i=this.schemaAssociations[n];if(i){let s=i.indexOf(t);s!==-1&&(i.splice(s,1),i.length===0&&delete this.schemaAssociations[n],this._onDidChangeSchemaAssociations.fire())}})}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}getSchemaContributions(){return{schemas:this.schemasById}}getSchemaContent(e){let t=this.schemasById[e];return t?L1(t):void 0}hasSchemaContent(e){return!!this.schemasById[e]}getSchemaAssociations(){return this.schemaAssociations}},CD=new Ov;Tt.add(Fv.JSONContribution,CD)});var ln,Uv,Er,Pd=w(()=>{Bn();Uv=globalThis.vscode;if(typeof Uv<"u"&&typeof Uv.context<"u"){let o=Uv.context.configuration();if(o)ln=o.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(ln=globalThis._VSCODE_PRODUCT_JSON,Sr.VSCODE_DEV&&Object.assign(ln,{nameShort:`${ln.nameShort} Dev`,nameLong:`${ln.nameLong} Dev`,dataFolderName:`${ln.dataFolderName}-dev`,serverDataFolderName:ln.serverDataFolderName?`${ln.serverDataFolderName}-dev`:void 0}),!ln.version){let o=globalThis._VSCODE_PACKAGE_JSON;Object.assign(ln,{version:o.version})}}else ln={nameShort:"Windsurf",nameLong:"Windsurf",applicationName:"windsurf",aliasName:"surf",dataFolderName:".windsurf",win32MutexName:"windsurf",licenseName:"MIT",licenseUrl:"https://windsurf.com/terms-of-service-individual",serverLicenseUrl:"https://windsurf.com/terms-of-service-individual",serverGreeting:[],serverLicense:[],serverLicensePrompt:"",serverApplicationName:"windsurf-server",serverDataFolderName:".windsurf-server",tunnelApplicationName:"windsurf-tunnel",win32DirName:"Windsurf",win32NameVersion:"Windsurf",win32RegValueName:"Windsurf",win32x64AppId:"{{A71B58E9-CEFB-4424-8A1D-A0E49CF18EBB}",win32arm64AppId:"{{9B0AE7D1-5CD0-43E6-B7B0-EE4B79723A25}",win32x64UserAppId:"{{5A8B7D94-9B5F-4D1F-93FC-5609F7159349}",win32arm64UserAppId:"{{1A69CEA0-8DA8-4B3E-950C-23FA9F850651}",win32AppUserModelId:"Exafunction.Windsurf",win32ShellNameShort:"Windsurf",win32TunnelServiceMutex:"windsurf-tunnelservice",win32TunnelMutex:"windsurf-tunnel",darwinBundleIdentifier:"com.exafunction.windsurf",darwinProfileUUID:"35631911-548E-4245-8C30-A1A0C65DCF7E",darwinProfilePayloadUUID:"53671443-8AE4-4FCA-B901-991F8B03A158",linuxIconName:"windsurf",licenseFileName:"LICENSE.txt",reportIssueUrl:"https://windsurf.com/redirect/windsurf/feedback?referrer=extension",nodejsRepository:"https://nodejs.org",urlProtocol:"windsurf",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",extensionsGallery:{serviceUrl:"https://marketplace.windsurf.com/vscode/gallery",itemUrl:"https://marketplace.windsurf.com/vscode/item",controlUrl:"https://marketplace.windsurf.com/vscode/extensions-control"},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"}}],____________EXTRA_WINDSURF_KEYS_START_HERE_______________:{},zendeskTicketApiKey:"1d83db0009861157cacd3279a927855f53279e48c84bd26d2ba48d241699773d",enableTelemetry:!0,aiConfig:{ariaKey:"windsurf"},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. "},extensionUntrustedWorkspaceSupport:{"codeium.windsurf":{override:!0}},chatParticipantRegistry:"https://main.vscode-cdn.net/extensions/chat.json",commandPaletteSuggestedCommandIds:["windsurf.prioritized.chat.open"],commonlyUsedSettings:["files.autoSave","editor.fontSize","editor.fontFamily","editor.tabSize","editor.renderWhitespace","editor.cursorStyle","editor.multiCursorModifier","editor.insertSpaces","editor.wordWrap","files.exclude","files.associations","workbench.editor.enablePreview"],defaultChatAgent:{extensionId:"GitHub.copilot",chatExtensionId:"GitHub.copilot-chat",chatExtensionOutputId:"GitHub.copilot-chat.GitHub Copilot Chat.log",chatExtensionOutputExtensionStateCommand:"github.copilot.debug.extensionState",documentationUrl:"https://aka.ms/github-copilot-overview",termsStatementUrl:"https://aka.ms/github-copilot-terms-statement",privacyStatementUrl:"https://aka.ms/github-copilot-privacy-statement",skusDocumentationUrl:"https://aka.ms/github-copilot-plans",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",upgradePlanUrl:"https://aka.ms/github-copilot-upgrade-plan",signUpUrl:"https://aka.ms/github-sign-up",provider:{default:{id:"github",name:"GitHub"},enterprise:{id:"github-enterprise",name:"GHE.com"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},providerExtensionId:"vscode.github-authentication",providerUriSetting:"github-enterprise.uri",providerScopes:[["read:user","user:email","repo","workflow"],["user:email"],["read:user"]],entitlementUrl:"",entitlementSignupLimitedUrl:"",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:"",mcpRegistryDataUrl:""},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"}}},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\\]"}}}},crashReporter:{productName:"Windsurf",companyName:"Exafunction"},enabledTelemetryLevels:{error:!0,usage:!0},exeBasedExtensionTips:{az:{friendlyName:"Azure CLI",windowsPath:"%ProgramFiles(x86)%\\Microsoft SDKs\\Azure\\CLI2\\wbin\\az.cmd",recommendations:{"ms-vscode.azurecli":{name:"Azure CLI Tools"}}},azd:{friendlyName:"Azure Dev CLI",windowsPath:"%USERPROFILE%\\AppData\\Local\\Programs\\Azure Dev CLI\\azd.exe",recommendations:{"ms-azuretools.vscode-azureresourcegroups":{name:"Azure Resources"}}},"azd-user":{friendlyName:"Azure Dev CLI",windowsPath:"%ProgramFiles%\\Azure Dev CLI\\azd.exe",recommendations:{"ms-azuretools.vscode-azureresourcegroups":{name:"Azure Resources"}}},heroku:{friendlyName:"Heroku CLI",windowsPath:"%ProgramFiles%\\Heroku\\bin\\heroku.cmd",recommendations:{"ms-azuretools.vscode-azureappservice":{name:"Azure App Service"}}},mongo:{friendlyName:"Mongo",windowsPath:"%ProgramFiles%\\MongoDB\\Server\\3.6\\bin\\mongod.exe",recommendations:{}},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:{"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-docker":{name:"Docker"}}},docker:{friendlyName:"Docker",windowsPath:"%ProgramFiles%\\Docker\\Docker\\Resources\\bin\\docker.exe",recommendations:{"ms-azuretools.vscode-docker":{name:"Docker",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-docker":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},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:{}},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"]}}},"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:{}},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-docker":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},minikube:{friendlyName:"MiniKube Local Kubernetes Cluster",recommendations:{"ms-azuretools.vscode-docker":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},podman:{friendlyName:"Podman",recommendations:{}},wsl:{friendlyName:"Windows Subsystem for Linux (WSL)",windowsPath:"%WINDIR%\\system32\\lxss\\LxssManager.dll",important:!0,recommendations:{}}},extensionAllowedBadgeProviders:["api.bintray.com","api.travis-ci.com","api.travis-ci.org","app.fossa.io","badge.buildkite.com","badge.fury.io","badge.waffle.io","badgen.net","badges.frapsoft.com","badges.gitter.im","badges.greenkeeper.io","cdn.travis-ci.com","cdn.travis-ci.org","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","gemnasium.com","githost.io","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","www.bithound.io","www.versioneye.com"],extensionAllowedBadgeProvidersRegex:["^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/(actions\\/)?workflows\\/.*badge\\.svg"],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","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"],"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"],"ms-python.gather":[]},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"]},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}},extensionRecommendations:{"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}"}]},"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-azuretools.vscode-docker":{onFileOpen:[{pathGlob:"{**/dockerfile,**/Dockerfile,**/docker-compose.yml,**/docker-compose.*.yml}",important:!0},{languages:["dockerfile"],important:!0},{pathGlob:"{**/*.cs,**/project.json,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln,**/appsettings.json,**/*.py,**/*.ipynb,**/*.js,**/*.ts,**/package.json}"}]},"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}]},"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}"}]},"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}"}]},"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}"}]},"Angular.ng-template":{onFileOpen:[{pathGlob:"{**/.angular-cli.json,**/angular.json,**/*.ng.html,**/*.ng,**/*.ngml}"}]},"vscjava.vscode-maven":{onFileOpen:[{pathGlob:"**/pom.xml"}]},"HashiCorp.terraform":{onFileOpen:[{pathGlob:"**/*.tf"}]},"ms-kubernetes-tools.vscode-kubernetes-tools":{onFileOpen:[{pathGlob:"{**/Chart.yaml}"}]},"betterthantomorrow.calva":{onFileOpen:[{pathGlob:"{**/*.clj,**/*.cljs}"}]},"vmware.vscode-boot-dev-pack":{onFileOpen:[{pathGlob:"{**/application.properties}"}]},"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}]}},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","alphabotsec.vscode-eclipse-keybindings","alefragnani.delphi-keybindings"],languageExtensionTips:["ms-python.python","codeium.windsurfpyright","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"],linkProtectionTrustedDomains:["https://open-vsx.org","https://marketplace.windsurf.com","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://*.codeium.com","https://*.windsurf.com","https://windsurf.com","https://codeium-staging-exafunction.vercel.app","https://staging.itsdev.in","https://app.devin.ai","https://app.beta.devin.ai","https://*.devinenterprise.com","https://beta.devinenterprise.com"],showTelemetryOptOut:!0,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"],"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"],microsoft:["ms-vscode.azure-repos","ms-vscode.remote-server","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azureresourcegroups","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-azureresourcegroups","ms-edu.vscode-learning","ms-toolsai.vscode-ai","ms-toolsai.vscode-ai-remote"],windsurf_auth:["codeium.windsurf"]},verifiedExtensionPublishers:{codeium:"https://windsurf.com"},extensionPublisherDisplayNameOverrides:{codeium:"Windsurf"},trustedExtensionPublishers:["meta"],trustedExtensionProtocolHandlers:["vscode.git","vscode.github-authentication","vscode.microsoft-authentication","codeium.windsurf"],webExtensionTips:["codespaces-contrib.codeswing","ms-vscode.vscode-github-issue-notebooks","esbenp.prettier-vscode","hediet.vscode-drawio"],tunnelServerQualities:{stable:{serverApplicationName:"windsurf-server"},next:{serverApplicationName:"windsurf-server-next"},insider:{serverApplicationName:"windsurf-server-insiders"}},quality:"stable",codeiumVersion:"1.48.2",codeiumCommit:"c46c49e94b4d3f41181204d59809d8f1b2c48d68",windsurfVersion:"2.3.15",win32ContextMenu:{x64:{clsid:"79B67B12-BD17-4CE4-B89B-F5F1AD10609A"},arm64:{clsid:"848C41FC-A2D0-4E67-9728-2AF87E61C814"}},updateUrl:"https://windsurf-stable.codeium.com",version:"1.110.1",commit:"c46c49e94b4d3f41181204d59809d8f1b2c48d68",date:"2026-05-27T02:08:16.904Z"},Object.keys(ln).length===0&&Object.assign(ln,{version:"1.104.2-dev",nameShort:"Windsurf Dev",nameLong:"Windsurf 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:[]}});Er=ln});function _D(o,r){return o===r?!0:!o||!r?!1:typeof o=="string"||typeof r=="string"?o===r:o.id===r.id}function Ka(o){let r=[];if(gi.test(o)){let e=F1.exec(o);for(;e?.length;){let t=e[1].trim();t&&r.push(t),e=F1.exec(o)}}return Wr(r)}function N1(o){return o.reduce((r,e)=>`${r}[${e}]`,"")}function kD(o){switch(Array.isArray(o)?o[0]:o){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}function RD(o,r,e){return o.trim()?gi.test(o)?h(1849,null,o):Sf.getConfigurationProperties()[o]!==void 0&&(!e||!DD.has(e.toLowerCase()))?h(1847,null,o):r.policy?.name&&Sf.getPolicyConfigurations().get(r.policy?.name)!==void 0?h(1846,null,o,r.policy?.name,Sf.getPolicyConfigurations().get(r.policy?.name)):null:h(1848,null)}var tr,hf,gf,vf,yf,wf,If,Ed,ks,bf,Nv,U1,F1,ko,gi,Sf,DD,Gi=w(()=>{zt();Q();We();Ce();st();O1();jn();K();Pd();tr={Configuration:"base.contributions.configuration"};hf={properties:{},patternProperties:{}},gf={properties:{},patternProperties:{}},vf={properties:{},patternProperties:{}},yf={properties:{},patternProperties:{}},wf={properties:{},patternProperties:{}},If={properties:{},patternProperties:{}},Ed={properties:{},patternProperties:{}},ks="vscode://schemas/settings/resourceLanguage",bf=Tt.as(Fv.JSONContribution),Nv=class extends C{constructor(){super();this.registeredConfigurationDefaults=[];this.overrideIdentifiers=new Set;this._onDidSchemaChange=this._register(new x);this.onDidSchemaChange=this._onDidSchemaChange.event;this._onDidUpdateConfiguration=this._register(new x);this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event;this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:h(1851,null),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},bf.registerSchema(ks,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){return this.registerConfigurations([e],t),e}registerConfigurations(e,t=!0){let n=new Set;this.doRegisterConfigurations(e,t,n),bf.registerSchema(ks,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n})}deregisterConfigurations(e){let t=new Set;this.doDeregisterConfigurations(e,t),bf.registerSchema(ks,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t})}updateConfigurations({add:e,remove:t}){let n=new Set;this.doDeregisterConfigurations(t,n),this.doRegisterConfigurations(e,!1,n),bf.registerSchema(ks,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n})}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 n=[];for(let{overrides:i,source:s}of e)for(let a in i){t.add(a);let l=this.configurationDefaultsOverrides.get(a)??this.configurationDefaultsOverrides.set(a,{configurationDefaultOverrides:[]}).get(a),c=i[a];if(l.configurationDefaultOverrides.push({value:c,source:s}),gi.test(a)){let d=this.mergeDefaultConfigurationsForOverrideIdentifier(a,c,s,l.configurationDefaultOverrideValue);if(!d)continue;l.configurationDefaultOverrideValue=d,this.updateDefaultOverrideProperty(a,d,s),n.push(...Ka(a))}else{let d=this.mergeDefaultConfigurationsForConfigurationProperty(a,c,s,l.configurationDefaultOverrideValue);if(!d)continue;l.configurationDefaultOverrideValue=d;let u=this.configurationProperties[a];u&&(this.updatePropertyDefaultValue(a,u),this.updateSchema(a,u))}}this.doRegisterOverrideIdentifiers(n)}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 n of e){let i=this.registeredConfigurationDefaults.indexOf(n);i!==-1&&this.registeredConfigurationDefaults.splice(i,1)}for(let{overrides:n,source:i}of e)for(let s in n){let a=this.configurationDefaultsOverrides.get(s);if(!a)continue;let l=a.configurationDefaultOverrides.findIndex(c=>i?_D(c.source,i):c.value===n[s]);if(l!==-1){if(a.configurationDefaultOverrides.splice(l,1),a.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(s),gi.test(s)){let c;for(let d of a.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForOverrideIdentifier(s,d.value,d.source,c);c&&!zp(c.value)?(a.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(s,c,i)):(this.configurationDefaultsOverrides.delete(s),delete this.configurationProperties[s],delete this.defaultLanguageConfigurationOverridesNode.properties[s])}else{let c;for(let u of a.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForConfigurationProperty(s,u.value,u.source,c);a.configurationDefaultOverrideValue=c;let d=this.configurationProperties[s];d&&(this.updatePropertyDefaultValue(s,d),this.updateSchema(s,d))}t.add(s)}}this.updateOverridePropertyPatternKey()}updateDefaultOverrideProperty(e,t,n){let i={section:{id:this.defaultLanguageConfigurationOverridesNode.id,title:this.defaultLanguageConfigurationOverridesNode.title,order:this.defaultLanguageConfigurationOverridesNode.order,extensionInfo:this.defaultLanguageConfigurationOverridesNode.extensionInfo},type:"object",default:t.value,description:h(1850,null,W1(e)),$ref:ks,defaultDefaultValue:t.value,source:n,defaultValueSource:n};this.configurationProperties[e]=i,this.defaultLanguageConfigurationOverridesNode.properties[e]=i}mergeDefaultConfigurationsForOverrideIdentifier(e,t,n,i){let s=i?.value||{},a=i?.source??new Map;if(!(a instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(let l of Object.keys(t)){let c=t[l];if(Je(c)&&(En(s[l])||Je(s[l]))){if(s[l]={...s[l]??{},...c},n)for(let u in c)a.set(`${l}.${u}`,n)}else s[l]=c,n?a.set(l,n):a.delete(l)}return{value:s,source:a}}mergeDefaultConfigurationsForConfigurationProperty(e,t,n,i){let s=this.configurationProperties[e],a=i?.value??s?.defaultDefaultValue,l=n;if(Je(t)&&(s!==void 0&&s.type==="object"||s===void 0&&(En(a)||Je(a)))){if(l=i?.source??new Map,!(l instanceof Map)){console.error("defaultValueSource is not a Map");return}for(let d in t)n&&l.set(`${e}.${d}`,n);t={...Je(a)?a:{},...t}}return{value:t,source:l}}deltaConfiguration(e){let t=!1,n=new Set;e.removedDefaults&&(this.doDeregisterDefaultConfigurations(e.removedDefaults,n),t=!0),e.addedDefaults&&(this.doRegisterDefaultConfigurations(e.addedDefaults,n),t=!0),e.removedConfigurations&&this.doDeregisterConfigurations(e.removedConfigurations,n),e.addedConfigurations&&this.doRegisterConfigurations(e.addedConfigurations,!1,n),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:n,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,n){e.forEach(i=>{this.validateAndRegisterProperties(i,t,i.extensionInfo,i.restrictedProperties,void 0,n),this.configurationContributors.push(i),this.registerJSONConfiguration(i)})}doDeregisterConfigurations(e,t){let n=i=>{if(i.properties)for(let s in i.properties){t.add(s);let a=this.configurationProperties[s];a?.policy?.name&&this.policyConfigurations.delete(a.policy.name),delete this.configurationProperties[s],this.removeFromSchema(s,i.properties[s])}i.allOf?.forEach(s=>n(s))};for(let i of e){n(i);let s=this.configurationContributors.indexOf(i);s!==-1&&this.configurationContributors.splice(s,1)}}validateAndRegisterProperties(e,t=!0,n,i,s=4,a){s=At(e.scope)?s:e.scope;let l=e.properties;if(l)for(let d in l){let u=l[d];if(u.section={id:e.id,title:e.title,order:e.order,extensionInfo:e.extensionInfo},t&&RD(d,u,n?.id)){delete l[d];continue}u.source=n,u.defaultDefaultValue=l[d].default,this.updatePropertyDefaultValue(d,u),gi.test(d)?u.scope=void 0:(u.scope=At(u.scope)?s:u.scope,u.restricted=At(u.restricted)?!!i?.includes(d):u.restricted),u.experiment?u.tags?.some(y=>y.toLowerCase()==="onexp")||(u.tags=u.tags??[],u.tags.push("onExP")):u.tags?.some(y=>y.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${d}'. Please use 'experiment' property instead.`),u.experiment={mode:"startup"});let f=l[d].hasOwnProperty("included")&&!l[d].included,m=l[d].policy?.name;f?(this.excludedConfigurationProperties[d]=l[d],m&&(this.policyConfigurations.set(m,d),a.add(d)),delete l[d]):(a.add(d),m&&this.policyConfigurations.set(m,d),this.configurationProperties[d]=l[d],!l[d].deprecationMessage&&l[d].markdownDeprecationMessage&&(l[d].deprecationMessage=l[d].markdownDeprecationMessage))}let c=e.allOf;if(c)for(let d of c)this.validateAndRegisterProperties(d,t,n,i,s,a)}getConfigurations(){return this.configurationContributors}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}getRegisteredDefaultConfigurations(){return[...this.registeredConfigurationDefaults]}getConfigurationDefaultsOverrides(){let e=new Map;for(let[t,n]of this.configurationDefaultsOverrides)n.configurationDefaultOverrideValue&&e.set(t,n.configurationDefaultOverrideValue);return e}registerJSONConfiguration(e){let t=n=>{let i=n.properties;if(i)for(let a in i)this.updateSchema(a,i[a]);n.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(hf.properties[e]=t,t.scope){case 1:gf.properties[e]=t;break;case 2:yf.properties[e]=t;break;case 3:vf.properties[e]=t;break;case 7:wf.properties[e]=t;break;case 4:If.properties[e]=t;break;case 5:Ed.properties[e]=t;break;case 6:Ed.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t;break}}removeFromSchema(e,t){switch(delete hf.properties[e],t.scope){case 1:delete gf.properties[e];break;case 2:delete yf.properties[e];break;case 3:delete vf.properties[e];break;case 7:delete wf.properties[e];break;case 4:delete If.properties[e];break;case 5:case 6:delete Ed.properties[e],delete this.resourceLanguageSettingsSchema.properties[e];break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let t=`[${e}]`,n={type:"object",description:h(1852,null),errorMessage:h(1853,null),$ref:ks};this.updatePropertyDefaultValue(t,n),hf.properties[t]=n,gf.properties[t]=n,vf.properties[t]=n,yf.properties[t]=n,wf.properties[t]=n,If.properties[t]=n,Ed.properties[t]=n}}registerOverridePropertyPatternKey(){let e={type:"object",description:h(1852,null),errorMessage:h(1853,null),$ref:ks};hf.patternProperties[ko]=e,gf.patternProperties[ko]=e,vf.patternProperties[ko]=e,yf.patternProperties[ko]=e,wf.patternProperties[ko]=e,If.patternProperties[ko]=e,Ed.patternProperties[ko]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){let n=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue,i,s;n&&(!t.disallowConfigurationDefault||!n.source)&&(i=n.value,s=n.source),En(i)&&(i=t.defaultDefaultValue,s=void 0),En(i)&&(i=kD(t.type)),t.default=i,t.defaultValueSource=s}},U1="\\[([^\\]]+)\\]",F1=new RegExp(U1,"g"),ko=`^(${U1})+$`,gi=new RegExp(ko);Sf=new Nv;Tt.add(tr.Configuration,Sf);DD=new Set(Er.defaultChatAgent?[Er.defaultChatAgent.extensionId,Er.defaultChatAgent.chatExtensionId].map(o=>o.toLowerCase()):[])});var WD,V1=w(()=>{Y();Sd();Ce();Gi();jn();WD=Tt.as(tr.Configuration);WD.registerConfiguration({id:"update",order:15,title:h(2702,null),type:"object",properties:{"update.mode":{type:"string",enum:["none","manual","start","default"],default:"default",scope:1,description:h(2703,null),tags:["usesOnlineServices"],enumDescriptions:[h(2699,null),h(2698,null),h(2701,null),h(2694,null)],policy:{name:"UpdateMode",category:"Update",minimumVersion:"1.67",localization:{description:{key:"updateMode",value:h(2703,null)},enumDescriptions:[{key:"none",value:h(2699,null)},{key:"manual",value:h(2698,null)},{key:"start",value:h(2701,null)},{key:"default",value:h(2694,null)}]}}},"update.channel":{type:"string",default:"default",scope:1,description:h(2703,null),deprecationMessage:h(2695,null,"update.mode")},"update.enableWindowsBackgroundUpdates":{type:"boolean",default:!0,scope:1,title:h(2697,null),description:h(2696,null),included:M&&!Dr},"update.showReleaseNotes":{type:"boolean",default:!0,scope:1,description:h(2700,null),tags:["usesOnlineServices"]}}})});function Bv(o,r){return r&&(o.stack||o.stacktrace)?h(119,null,K1(o),H1(o.stack)||H1(o.stacktrace)):K1(o)}function H1(o){return Array.isArray(o)?o.join(`
`):o}function K1(o){return o.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${o.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof o.code=="string"&&typeof o.errno=="number"&&typeof o.syscall=="string"?h(118,null,o.message):o.message||h(116,null)}function Tr(o=null,r=!1){if(!o)return h(116,null);if(Array.isArray(o)){let e=at(o),t=Tr(e[0],r);return e.length>1?h(117,null,t,e.length):t}if(Ae(o))return o;if(o.detail){let e=o.detail;if(e.error)return Bv(e.error,r);if(e.exception)return Bv(e.exception,r)}return o.stack?Bv(o,r):o.message?o.message:h(116,null)}var Ro=w(()=>{zt();We();Ce()});function ji(o,r){let{os:e,tildify:t,relative:n}=r;if(n){let a=LD(o,n,e);if(typeof a=="string")return a}let i=o.fsPath;if(e===1&&!M?i=i.replace(/\//g,"\\"):e!==1&&M&&(i=i.replace(/\\/g,"/")),e!==1&&t?.userHome){let a=t.userHome.fsPath,l;o.scheme!==t.userHome.scheme&&o.path[0]===ue.sep&&o.path[1]!==ue.sep?l=t.userHome.with({path:o.path}).fsPath:l=i,i=AD(l,a,e)}return(e===1?ut:ue).normalize(Cd(i,e===1))}function LD(o,r,e){let t=e===1?ut:ue,n=e===3?Me:Oa,i=r.getWorkspace(),s=i.folders.at(0);if(!s)return;o.scheme!==s.uri.scheme&&o.path[0]===ue.sep&&o.path[1]!==ue.sep&&(o=s.uri.with({path:o.path}));let a=r.getWorkspaceFolder(o);if(!a)return;let l;if(n.isEqual(a.uri,o)?l="":l=n.relativePath(a.uri,o)??"",l&&(l=t.normalize(l)),i.folders.length>1&&!r.noPrefix){let c=a.name?a.name:n.basenameOrAuthority(a.uri);l=l?`${c} \u2022 ${l}`:c}return l}function Cd(o,r=M){return Sv(o,r)?o.charAt(0).toUpperCase()+o.slice(1):o}function AD(o,r,e=Lt){if(e===1||!o||!r)return o;let t=Vv.original===r?Vv.normalized:void 0;t||(t=r,M&&(t=fi(t)),t=`${$n(t,ue.sep)}${ue.sep}`,Vv={original:r,normalized:t});let n=o;return M&&(n=fi(n)),(e===3?n.startsWith(t):Eo(n,t))?`~/${n.substr(t.length)}`:o}function q1(o,r){return V||r?o.replace(/\(&&\w\)|&&/g,"").replace(/&/g,V?"&":"&&"):o.replace(/&&|&/g,e=>e==="&"?"&&":"&")}function _d(o,r){let e=o.replace(/\(&&\w\)|&&/g,"");if(r)return e;if(V)return{withMnemonic:e,withoutMnemonic:e};let t;return M?t=o.replace(/&&|&/g,n=>n==="&"?"&&":"&"):t=o.replace(/&&/g,"_"),{withMnemonic:t,withoutMnemonic:e}}function z1(o){if(o.endsWith("]")){let r=o.lastIndexOf(" [",o.length-2);if(r!==-1){let e=$1(o.substring(0,r)),t=o.substring(r);return{name:e.name+t,parentPath:e.parentPath}}}return $1(o)}function $1(o){let r=o.indexOf("/")!==-1?ue:ut,e=r.basename(o),t=r.dirname(o);return e.length?{name:e,parentPath:t}:{name:t,parentPath:""}}var Vv,Ji=w(()=>{an();Se();Y();yt();dr();Vv=Object.create(null)});function kd(o){let r=o;return r?[r.on,r.pause,r.resume,r.destroy].every(e=>typeof e=="function"):!1}function xf(o){let r=o;return r?kd(r.stream)&&Array.isArray(r.buffer)&&typeof r.ended=="boolean":!1}function Do(o,r){return new Hv(o,r)}function G1(o,r){let e=[],t;for(;(t=o.read())!==null;)e.push(t);return r(e)}function j1(o,r,e){let t=[],n;for(;(n=o.read())!==null&&t.length<e;)t.push(n);return n===null&&t.length>0?r(t):{read:()=>{if(t.length>0)return t.shift();if(typeof n<"u"){let i=n;return n=void 0,i}return o.read()}}}function Pf(o,r){return new Promise((e,t)=>{let n=[];$a(o,{onData:i=>{r&&n.push(i)},onError:i=>{r?t(i):e(void 0)},onEnd:()=>{e(r?r(n):void 0)}})})}function $a(o,r,e){o.on("error",t=>{e?.isCancellationRequested||r.onError(t)}),o.on("end",()=>{e?.isCancellationRequested||r.onEnd()}),o.on("data",t=>{e?.isCancellationRequested||r.onData(t)})}function J1(o,r){return new Promise((e,t)=>{let n=new te,i=[],s=c=>{if(i.push(c),i.length>r)return n.dispose(),o.pause(),e({stream:o,buffer:i,ended:!1})},a=c=>(n.dispose(),t(c)),l=()=>(n.dispose(),e({stream:o,buffer:i,ended:!0}));n.add(j(()=>o.removeListener("error",a))),o.on("error",a),n.add(j(()=>o.removeListener("end",l))),o.on("end",l),n.add(j(()=>o.removeListener("data",s))),o.on("data",s)})}function Q1(o){let r=!1;return{read:()=>r?null:(r=!0,o)}}function Ef(o,r,e){let t=Do(e);return $a(o,{onData:n=>t.write(r.data(n)),onError:n=>t.error(r.error?r.error(n):n),onEnd:()=>t.end()}),t}var Hv,qa=w(()=>{Ve();K();Hv=class{constructor(r,e){this.reducer=r;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(r){if(!this.state.destroyed){if(this.state.flowing)this.emitData(r);else if(this.buffer.data.push(r),typeof this.options?.highWaterMark=="number"&&this.buffer.data.length>this.options.highWaterMark)return new Promise(e=>this.pendingWritePromises.push(e))}}error(r){this.state.destroyed||(this.state.flowing?this.emitError(r):this.buffer.error.push(r))}end(r){this.state.destroyed||(typeof r<"u"&&this.write(r),this.state.flowing?(this.emitEnd(),this.destroy()):this.state.ended=!0)}emitData(r){this.listeners.data.slice(0).forEach(e=>e(r))}emitError(r){this.listeners.error.length===0?rt(r):this.listeners.error.slice(0).forEach(e=>e(r))}emitEnd(){this.listeners.end.slice(0).forEach(r=>r())}on(r,e){if(!this.state.destroyed)switch(r){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(r,e){if(this.state.destroyed)return;let t;switch(r){case"data":t=this.listeners.data;break;case"end":t=this.listeners.end;break;case"error":t=this.listeners.error;break}if(t){let n=t.indexOf(e);n>=0&&t.splice(n,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 r=[...this.pendingWritePromises];this.pendingWritePromises.length=0,r.forEach(e=>e())}flowErrors(){if(this.listeners.error.length>0){for(let r of this.buffer.error)this.emitError(r);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 FD(o,r,e=0){let t=r.byteLength,n=o.byteLength;if(t===0)return 0;if(t===1)return o.indexOf(r[0],e);if(t>n-e)return-1;let i=OD.value;i.fill(r.length);for(let c=0;c<r.length;c++)i[r[c]]=r.length-c-1;let s=e+r.length-1,a=s,l=-1;for(;s<n;)if(o[s]===r[a]){if(a===0){l=s;break}s--,a--}else s+=Math.max(r.length-a,i[o[s]]),a=r.length-1;return l}function UD(o,r){return o[r]*2**24+o[r+1]*2**16+o[r+2]*2**8+o[r+3]}function ND(o,r,e){o[e+3]=r,r=r>>>8,o[e+2]=r,r=r>>>8,o[e+1]=r,r=r>>>8,o[e]=r}function BD(o,r){return o[r+0]<<0>>>0|o[r+1]<<8>>>0|o[r+2]<<16>>>0|o[r+3]<<24>>>0}function VD(o,r,e){o[e+0]=r&255,r=r>>>8,o[e+1]=r&255,r=r>>>8,o[e+2]=r&255,r=r>>>8,o[e+3]=r&255}function HD(o,r){return o[r]}function KD(o,r,e){o[e]=r}function Y1(o){return G1(o,r=>H.concat(r))}function Z1(o){return Q1(o)}function Ds(o){return Pf(o,r=>H.concat(r))}async function ex(o){return o.ended?H.concat(o.buffer):H.concat([...o.buffer,await Ds(o.stream)])}function tx(o){return Ef(o,{data:r=>typeof r=="string"?H.fromString(r):H.wrap(r)},r=>H.concat(r))}function rx(o){return Do(r=>H.concat(r),o)}function nx({buffer:o}){let r="";for(let e=0;e<o.length;e++){let t=o[e];r+=X1[t>>>4],r+=X1[t&15]}return r}var Rd,OD,Kv,$v,H,X1,nt=w(()=>{xo();qa();Rd=typeof Buffer<"u",OD=new xr(()=>new Uint8Array(256)),H=class o{static alloc(r){return Rd?new o(Buffer.allocUnsafe(r)):new o(new Uint8Array(r))}static wrap(r){return Rd&&!Buffer.isBuffer(r)&&(r=Buffer.from(r.buffer,r.byteOffset,r.byteLength)),new o(r)}static fromString(r,e){return!(e?.dontUseNodeBuffer||!1)&&Rd?new o(Buffer.from(r)):(Kv||(Kv=new TextEncoder),new o(Kv.encode(r)))}static fromByteArray(r){let e=o.alloc(r.length);for(let t=0,n=r.length;t<n;t++)e.buffer[t]=r[t];return e}static concat(r,e){if(typeof e>"u"){e=0;for(let i=0,s=r.length;i<s;i++)e+=r[i].byteLength}let t=o.alloc(e),n=0;for(let i=0,s=r.length;i<s;i++){let a=r[i];t.set(a,n),n+=a.byteLength}return t}static isNativeBuffer(r){return Rd&&Buffer.isBuffer(r)}constructor(r){this.buffer=r,this.byteLength=this.buffer.byteLength}clone(){let r=o.alloc(this.byteLength);return r.set(this),r}toString(){return Rd?this.buffer.toString():($v||($v=new TextDecoder(void 0,{ignoreBOM:!0})),$v.decode(this.buffer))}slice(r,e){return new o(this.buffer.subarray(r,e))}set(r,e){if(r instanceof o)this.buffer.set(r.buffer,e);else if(r instanceof Uint8Array)this.buffer.set(r,e);else if(r instanceof ArrayBuffer)this.buffer.set(new Uint8Array(r),e);else if(ArrayBuffer.isView(r))this.buffer.set(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),e);else throw new Error("Unknown argument 'array'")}readUInt32BE(r){return UD(this.buffer,r)}writeUInt32BE(r,e){ND(this.buffer,r,e)}readUInt32LE(r){return BD(this.buffer,r)}writeUInt32LE(r,e){VD(this.buffer,r,e)}readUInt8(r){return HD(this.buffer,r)}writeUInt8(r,e){KD(this.buffer,r,e)}indexOf(r,e=0){return FD(this.buffer,r instanceof o?r.buffer:r,e)}equals(r){return this===r?!0:this.byteLength!==r.byteLength?!1:this.buffer.every((e,t)=>e===r.buffer[t])}};X1="0123456789abcdef"});var ix=w(()=>{We();K();St()});function de(o,r,e){let t=null,n=null;if(typeof e.value=="function"?(t="value",n=e.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(t="get",n=e.get),!n)throw new Error("not supported");let i=`$memoize$${r}`;e[t]=function(...s){return this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,s)}),this[i]}}var Wo=w(()=>{ix()});function ox(o){return JSON.stringify(o,$D)}function sx(o){let r=JSON.parse(o);return r=Jn(r),r}function $D(o,r){return r instanceof RegExp?{$mid:2,source:r.source,flags:r.flags}:r}function Jn(o,r=0){if(!o||r>200)return o;if(typeof o=="object"){switch(o.$mid){case 1:return b.revive(o);case 2:return new RegExp(o.source,o.flags);case 17:return new Date(o.source)}if(o instanceof H||o instanceof Uint8Array)return o;if(Array.isArray(o))for(let e=0;e<o.length;++e)o[e]=Jn(o[e],r+1);else for(let e in o)Object.hasOwnProperty.call(o,e)&&(o[e]=Jn(o[e],r+1))}return o}var Dd=w(()=>{nt();se();ef()});function ja(o){switch(o){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function Tf(o){switch(o){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function za(o){let r=0;for(let e=0;;e+=7){let t=o.read(1);if(r|=(t.buffer[0]&127)<<e,!(t.buffer[0]&128))return r}}function Ga(o,r){if(r===0){o.write(qD);return}let e=0;for(let n=r;n!==0;n=n>>>7)e++;let t=H.alloc(e);for(let n=0;r!==0;n++)t.buffer[n]=r&127,r=r>>>7,r>0&&(t.buffer[n]|=128);o.write(t)}function Lo(o){let r=H.alloc(1);return r.writeUInt8(o,0),r}function Ja(o,r){if(typeof r>"u")o.write(Ws.Undefined);else if(typeof r=="string"){let e=H.fromString(r);o.write(Ws.String),Ga(o,e.byteLength),o.write(e)}else if(H.isNativeBuffer(r)){let e=H.wrap(r);o.write(Ws.Buffer),Ga(o,e.byteLength),o.write(e)}else if(r instanceof H)o.write(Ws.VSBuffer),Ga(o,r.byteLength),o.write(r);else if(Array.isArray(r)){o.write(Ws.Array),Ga(o,r.length);for(let e of r)Ja(o,e)}else if(typeof r=="number"&&(r|0)===r)o.write(Ws.Uint),Ga(o,r);else{let e=H.fromString(JSON.stringify(r));o.write(Ws.Object),Ga(o,e.byteLength),o.write(e)}}function Qa(o){switch(o.read(1).readUInt8(0)){case 0:return;case 1:return o.read(za(o)).toString();case 2:return o.read(za(o)).buffer;case 3:return o.read(za(o));case 4:{let e=za(o),t=[];for(let n=0;n<e;n++)t.push(Qa(o));return t}case 5:return JSON.parse(o.read(za(o)).toString());case 6:return za(o)}}function Md(o){return{call(r,e,t){return o.then(n=>n.call(r,e,t))},listen(r,e){let t=new dd;return o.then(n=>t.input=n.listen(r,e)),t.event}}}function ax(o){let r=!1;return{call(e,t,n){return r?o.call(e,t,n):lt(0).then(()=>r=!0).then(()=>o.call(e,t,n))},listen(e,t){if(r)return o.listen(e,t);let n=new dd;return lt(0).then(()=>r=!0).then(()=>n.input=o.listen(e,t)),n.event}}}var qD,Wd,Ld,Ws,Ad,Ls,Xa,Ya,Cf,He,vi=w(()=>{zt();he();nt();St();Wo();Ve();Q();Pa();K();Dd();dr();We();qD=Lo(0);Wd=class{constructor(r){this.buffer=r;this.pos=0}read(r){let e=this.buffer.slice(this.pos,this.pos+r);return this.pos+=e.byteLength,e}},Ld=class{constructor(){this.buffers=[]}get buffer(){return H.concat(this.buffers)}write(r){this.buffers.push(r)}};Ws={Undefined:Lo(0),String:Lo(1),Buffer:Lo(2),VSBuffer:Lo(3),Array:Lo(4),Object:Lo(5),Uint:Lo(6)};Ad=class{constructor(r,e,t=null,n=1e3){this.protocol=r;this.ctx=e;this.logger=t;this.timeoutDelay=n;this.channels=new Map;this.activeRequests=new Map;this.pendingRequests=new Map;this.protocolListener=this.protocol.onMessage(i=>this.onRawMessage(i)),this.sendResponse({type:200})}registerChannel(r,e){this.channels.set(r,e),setTimeout(()=>this.flushPendingRequests(r),0)}sendResponse(r){switch(r.type){case 200:{let e=this.send([r.type]);this.logger?.logOutgoing(e,0,1,Tf(r.type));return}case 201:case 202:case 204:case 203:{let e=this.send([r.type,r.id],r.data);this.logger?.logOutgoing(e,r.id,1,Tf(r.type),r.data);return}}}send(r,e=void 0){let t=new Ld;return Ja(t,r),Ja(t,e),this.sendBuffer(t.buffer)}sendBuffer(r){try{return this.protocol.send(r),r.byteLength}catch{return 0}}onRawMessage(r){let e=new Wd(r),t=Qa(e),n=Qa(e),i=t[0];switch(i){case 100:return this.logger?.logIncoming(r.byteLength,t[1],1,`${ja(i)}: ${t[2]}.${t[3]}`,n),this.onPromise({type:i,id:t[1],channelName:t[2],name:t[3],arg:n});case 102:return this.logger?.logIncoming(r.byteLength,t[1],1,`${ja(i)}: ${t[2]}.${t[3]}`,n),this.onEventListen({type:i,id:t[1],channelName:t[2],name:t[3],arg:n});case 101:return this.logger?.logIncoming(r.byteLength,t[1],1,`${ja(i)}`),this.disposeActiveRequest({type:i,id:t[1]});case 103:return this.logger?.logIncoming(r.byteLength,t[1],1,`${ja(i)}`),this.disposeActiveRequest({type:i,id:t[1]})}}onPromise(r){let e=this.channels.get(r.channelName);if(!e){this.collectPendingRequest(r);return}let t=new qe,n;try{n=e.call(this.ctx,r.name,r.arg,t.token)}catch(a){n=Promise.reject(a)}let i=r.id;n.then(a=>{this.sendResponse({id:i,data:a,type:201})},a=>{a instanceof Error?this.sendResponse({id:i,data:{message:a.message,name:a.name,stack:a.stack?a.stack.split(`
`):void 0},type:202}):this.sendResponse({id:i,data:a,type:203})}).finally(()=>{s.dispose(),this.activeRequests.delete(r.id)});let s=j(()=>t.cancel());this.activeRequests.set(r.id,s)}onEventListen(r){let e=this.channels.get(r.channelName);if(!e){this.collectPendingRequest(r);return}let t=r.id,i=e.listen(this.ctx,r.name,r.arg)(s=>this.sendResponse({id:t,data:s,type:204}));this.activeRequests.set(r.id,i)}disposeActiveRequest(r){let e=this.activeRequests.get(r.id);e&&(e.dispose(),this.activeRequests.delete(r.id))}collectPendingRequest(r){let e=this.pendingRequests.get(r.channelName);e||(e=[],this.pendingRequests.set(r.channelName,e));let t=setTimeout(()=>{console.error(`Unknown channel: ${r.channelName}`),r.type===100&&this.sendResponse({id:r.id,data:{name:"Unknown channel",message:`Channel name '${r.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);e.push({request:r,timeoutTimer:t})}flushPendingRequests(r){let e=this.pendingRequests.get(r);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(r)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),pt(this.activeRequests.values()),this.activeRequests.clear()}},Ls=class{constructor(r,e=null){this.protocol=r;this.isDisposed=!1;this.state=0;this.activeRequests=new Set;this.handlers=new Map;this.lastRequestId=0;this._onDidInitialize=new x;this.onDidInitialize=this._onDidInitialize.event;this.protocolListener=this.protocol.onMessage(t=>this.onBuffer(t)),this.logger=e}getChannel(r){let e=this;return{call(t,n,i){return e.isDisposed?Promise.reject(new Et):e.requestPromise(r,t,n,i)},listen(t,n){return e.isDisposed?E.None:e.requestEvent(r,t,n)}}}requestPromise(r,e,t,n=be.None){let i=this.lastRequestId++,a={id:i,type:100,channelName:r,name:e,arg:t};if(n.isCancellationRequested)return Promise.reject(new Et);let l,c;return new Promise((u,f)=>{if(n.isCancellationRequested)return f(new Et);let m=()=>{let S=I=>{switch(I.type){case 201:this.handlers.delete(i),u(I.data);break;case 202:{this.handlers.delete(i);let k=new Error(I.data.message);k.stack=Array.isArray(I.data.stack)?I.data.stack.join(`
`):I.data.stack,k.name=I.data.name,f(k);break}case 203:this.handlers.delete(i),f(I.data);break}};this.handlers.set(i,S),this.sendRequest(a)},y=null;this.state===1?m():(y=zn(S=>this.whenInitialized()),y.then(()=>{y=null,m()}));let v=()=>{y?(y.cancel(),y=null):this.sendRequest({id:i,type:101}),f(new Et)};l=n.onCancellationRequested(v),c={dispose:Hi(()=>{v(),l.dispose()})},this.activeRequests.add(c)}).finally(()=>{l?.dispose(),this.activeRequests.delete(c)})}requestEvent(r,e,t){let n=this.lastRequestId++,s={id:n,type:102,channelName:r,name:e,arg:t},a=null,l=new x({onWillAddFirstListener:()=>{let d=()=>{this.activeRequests.add(l),this.sendRequest(s)};this.state===1?d():(a=zn(u=>this.whenInitialized()),a.then(()=>{a=null,d()}))},onDidRemoveLastListener:()=>{a?(a.cancel(),a=null):(this.activeRequests.delete(l),this.sendRequest({id:n,type:103})),this.handlers.delete(n)}}),c=d=>l.fire(d.data);return this.handlers.set(n,c),l.event}sendRequest(r){switch(r.type){case 100:case 102:{let e=this.send([r.type,r.id,r.channelName,r.name],r.arg);this.logger?.logOutgoing(e,r.id,0,`${ja(r.type)}: ${r.channelName}.${r.name}`,r.arg);return}case 101:case 103:{let e=this.send([r.type,r.id]);this.logger?.logOutgoing(e,r.id,0,ja(r.type));return}}}send(r,e=void 0){let t=new Ld;return Ja(t,r),Ja(t,e),this.sendBuffer(t.buffer)}sendBuffer(r){try{return this.protocol.send(r),r.byteLength}catch{return 0}}onBuffer(r){let e=new Wd(r),t=Qa(e),n=Qa(e),i=t[0];switch(i){case 200:return this.logger?.logIncoming(r.byteLength,0,0,Tf(i)),this.onResponse({type:t[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(r.byteLength,t[1],0,Tf(i),n),this.onResponse({type:t[0],id:t[1],data:n})}}onResponse(r){if(r.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(r.id)?.(r)}get onDidInitializePromise(){return E.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),pt(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};T([de],Ls.prototype,"onDidInitializePromise",1);Xa=class{constructor(r,e,t){this.channels=new Map;this._connections=new Set;this._onDidAddConnection=new x;this.onDidAddConnection=this._onDidAddConnection.event;this._onDidRemoveConnection=new x;this.onDidRemoveConnection=this._onDidRemoveConnection.event;this.disposables=new te;this.disposables.add(r(({protocol:n,onDidClientDisconnect:i})=>{let s=E.once(n.onMessage);this.disposables.add(s(a=>{let l=new Wd(a),c=Qa(l),d=new Ad(n,c,e,t),u=new Ls(n,e);this.channels.forEach((m,y)=>d.registerChannel(y,m));let f={channelServer:d,channelClient:u,ctx:c};this._connections.add(f),this._onDidAddConnection.fire(f),this.disposables.add(i(()=>{d.dispose(),u.dispose(),this._connections.delete(f),this._onDidRemoveConnection.fire(f)}))}))}))}get connections(){let r=[];return this._connections.forEach(e=>r.push(e)),r}getChannel(r,e){let t=this;return{call(n,i,s){let a;if(od(e)){let c=gS(t.connections.filter(e));a=c?Promise.resolve(c):E.toPromise(E.filter(t.onDidAddConnection,e))}else a=e.routeCall(t,n,i);let l=a.then(c=>c.channelClient.getChannel(r));return Md(l).call(n,i,s)},listen(n,i){if(od(e))return t.getMulticastEvent(r,e,n,i);let s=e.routeEvent(t,n,i).then(a=>a.channelClient.getChannel(r));return Md(s).listen(n,i)}}}getMulticastEvent(r,e,t,n){let i=this,s,a=new x({onWillAddFirstListener:()=>{s=new te;let l=new jp,c=new Map,d=f=>{let y=f.channelClient.getChannel(r).listen(t,n),v=l.add(y);c.set(f,v)},u=f=>{let m=c.get(f);m&&(m.dispose(),c.delete(f))};i.connections.filter(e).forEach(d),E.filter(i.onDidAddConnection,e)(d,void 0,s),i.onDidRemoveConnection(u,void 0,s),l.event(a.fire,a,s),s.add(l)},onDidRemoveLastListener:()=>{s?.dispose(),s=void 0}});return i.disposables.add(a),a.event}registerChannel(r,e){this.channels.set(r,e);for(let t of this._connections)t.channelServer.registerChannel(r,e)}dispose(){this.disposables.dispose();for(let r of this._connections)r.channelClient.dispose(),r.channelServer.dispose();this._connections.clear(),this.channels.clear(),this._onDidAddConnection.dispose(),this._onDidRemoveConnection.dispose()}},Ya=class{constructor(r,e,t=null){let n=new Ld;Ja(n,e),r.send(n.buffer),this.channelClient=new Ls(r,t),this.channelServer=new Ad(r,e,t)}getChannel(r){return this.channelClient.getChannel(r)}registerChannel(r,e){this.channelServer.registerChannel(r,e)}dispose(){this.channelClient.dispose(),this.channelServer.dispose()}};Cf=class{constructor(r){this.fn=r}routeCall(r){return this.route(r)}routeEvent(r){return this.route(r)}async route(r){for(let e of r.connections)if(await Promise.resolve(this.fn(e.ctx)))return Promise.resolve(e);return await E.toPromise(r.onDidAddConnection),await this.route(r)}};(n=>{function o(i,s,a){let l=i,c=a?.disableMarshalling,d=new Map;for(let u in l)e(u)&&d.set(u,E.buffer(l[u],!0,void 0,s));return new class{listen(u,f,m){let y=d.get(f);if(y)return y;let v=l[f];if(typeof v=="function"){if(t(f))return v.call(l,m);if(e(f))return d.set(f,E.buffer(l[f],!0,void 0,s)),d.get(f)}throw new on(`Event not found: ${f}`)}call(u,f,m){let y=l[f];if(typeof y=="function"){if(!c&&Array.isArray(m))for(let S=0;S<m.length;S++)m[S]=Jn(m[S]);let v=y.apply(l,m);return v instanceof Promise||(v=Promise.resolve(v)),v}throw new on(`Method not found: ${f}`)}}}n.fromService=o;function r(i,s){let a=s?.disableMarshalling;return new Proxy({},{get(l,c){if(typeof c=="string")return s?.properties?.has(c)?s.properties.get(c):t(c)?function(d){return i.listen(c,d)}:e(c)?i.listen(c):async function(...d){let u;s&&!At(s.context)?u=[s.context,...d]:u=d;let f=await i.call(c,u);return a?f:Jn(f)};throw new on(`Property not found: ${String(c)}`)}})}n.toService=r;function e(i){return i[0]==="o"&&i[1]==="n"&&vv(i.charCodeAt(2))}function t(i){return/^onDynamic/.test(i)&&vv(i.charCodeAt(9))}})(He||={})});function lx(o){return zD.test(o)}var zD,xe,Mt=w(()=>{zD=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;xe=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let o=new Uint8Array(16),r=[];for(let e=0;e<256;e++)r.push(e.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(o),o[6]=o[6]&15|64,o[8]=o[8]&63|128;let t=0,n="";return n+=r[o[t++]],n+=r[o[t++]],n+=r[o[t++]],n+=r[o[t++]],n+="-",n+=r[o[t++]],n+=r[o[t++]],n+="-",n+=r[o[t++]],n+=r[o[t++]],n+="-",n+=r[o[t++]],n+=r[o[t++]],n+="-",n+=r[o[t++]],n+=r[o[t++]],n+=r[o[t++]],n+=r[o[t++]],n+=r[o[t++]],n+=r[o[t++]],n}})()});function Ao(){return qv||(qv=H.alloc(0)),qv}function cx(o){switch(o){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 Jv,qv,Od,hn,Fd,Ud,Nd,Bd,As,zv,Gv,jv,_f,Qv=w(()=>{nt();Q();K();vi();(s=>{s.enableDiagnostics=!1,s.records=[];let e=new WeakMap,t=0;function n(a,l){if(!e.has(a)){let c=String(++t);e.set(a,c)}return e.get(a)}function i(a,l,c,d){}s.traceSocketEvent=i})(Jv||={});qv=null;Od=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(r){this._chunks.push(r),this._totalLength+=r.byteLength}read(r){return this._read(r,!0)}peek(r){return this._read(r,!1)}_read(r,e){if(r===0)return Ao();if(r>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===r){let s=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=r),s}if(this._chunks[0].byteLength>r){let s=this._chunks[0].slice(0,r);return e&&(this._chunks[0]=this._chunks[0].slice(r),this._totalLength-=r),s}let t=H.alloc(r),n=0,i=0;for(;r>0;){let s=this._chunks[i];if(s.byteLength>r){let a=s.slice(0,r);t.set(a,n),n+=r,e&&(this._chunks[i]=s.slice(r),this._totalLength-=r),r-=r}else t.set(s,n),n+=s.byteLength,e?(this._chunks.shift(),this._totalLength-=s.byteLength):i++,r-=s.byteLength}return t}};hn=class{constructor(r,e,t,n){this.type=r;this.id=e;this.ack=t;this.data=n;this.writtenTime=0}get size(){return this.data.byteLength}},Fd=class extends C{constructor(e){super();this._onMessage=this._register(new x);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 Od,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:cx(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let n=this._state.messageType,i=this._state.id,s=this._state.ack;if(this._state.readHead=!0,this._state.readLen=13,this._state.messageType=0,this._state.id=0,this._state.ack=0,this._socket.traceSocketEvent("protocolMessageRead",t),this._onMessage.fire(new hn(n,i,s,t)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},Ud=class{constructor(r){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=r,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(r){if(this._isDisposed)return;r.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=H.alloc(13);e.writeUInt8(r.type,0),e.writeUInt32BE(r.id,1),e.writeUInt32BE(r.ack,5),e.writeUInt32BE(r.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:cx(r.type),id:r.id,ack:r.ack,messageSize:r.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",r.data),this._writeSoon(e,r.data)}_bufferAdd(r,e){let t=this._totalLength===0;return this._data.push(r,e),this._totalLength+=r.byteLength+e.byteLength,t}_bufferTake(){let r=H.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,r}_writeSoon(r,e){this._bufferAdd(r,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let r=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:r.byteLength}),this._socket.write(r)}},Nd=class extends C{constructor(e){super();this._onMessage=this._register(new x);this.onMessage=this._onMessage.event;this._onDidDispose=this._register(new x);this.onDidDispose=this._onDidDispose.event;this._socket=e,this._socketWriter=this._register(new Ud(this._socket)),this._socketReader=this._register(new Fd(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 hn(1,0,0,e))}},Bd=class o extends Ya{constructor(e,t,n=null){super(e,t,n);this.protocol=e}static fromSocket(e,t){return new o(new Nd(e),t)}get onDidDispose(){return this.protocol.onDidDispose}dispose(){super.dispose();let e=this.protocol.getSocket();this.protocol.sendDisconnect(),this.protocol.dispose(),e.end()}},As=class{constructor(){this._hasListeners=!1;this._isDeliveringMessages=!1;this._bufferedMessages=[];this._emitter=new x({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(r){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(r):this._emitter.fire(r):this._bufferedMessages.push(r)}flushBuffer(){this._bufferedMessages=[]}},zv=class{constructor(r){this.data=r,this.next=null}},Gv=class{constructor(){this._first=null,this._last=null}length(){let r=0,e=this._first;for(;e;)e=e.next,r++;return r}peek(){return this._first?this._first.data:null}toArray(){let r=[],e=0,t=this._first;for(;t;)r[e++]=t.data,t=t.next;return r}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(r){let e=new zv(r);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},jv=class o{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return o._INSTANCE||(o._INSTANCE=new o),o._INSTANCE}constructor(){this.lastRuns=[];let r=Date.now();for(let e=0;e<o._HISTORY_LENGTH;e++)this.lastRuns[e]=r-1e3*e;setInterval(()=>{for(let e=o._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let r=Date.now(),e=(1+o._HISTORY_LENGTH)*1e3,t=0;for(let n=0;n<o._HISTORY_LENGTH;n++)r-this.lastRuns[n]<=e&&t++;return 1-t/o._HISTORY_LENGTH}hasHighLoad(){return this.load()>=.5}},_f=class{constructor(r){this._onControlMessage=new As;this.onControlMessage=this._onControlMessage.event;this._onMessage=new As;this.onMessage=this._onMessage.event;this._onDidDispose=new As;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new As;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new As;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=r.loadEstimator??jv.getInstance(),this._shouldSendKeepAlive=r.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new Gv,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 te,this._socket=r.socket,this._socketWriter=this._socketDisposables.add(new Ud(this._socket)),this._socketReader=this._socketDisposables.add(new Fd(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),r.initialChunk&&this._socketReader.acceptChunk(r.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 r=new hn(5,0,0,Ao());this._socketWriter.write(r),this._socketWriter.flush()}}sendPause(){let r=new hn(7,0,0,Ao());this._socketWriter.write(r)}sendResume(){let r=new hn(8,0,0,Ao());this._socketWriter.write(r)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(r,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new te,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=r,this._socketWriter=this._socketDisposables.add(new Ud(this._socket)),this._socketReader=this._socketDisposables.add(new Fd(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 r=new hn(3,0,this._incomingAckId,Ao());this._socketWriter.write(r);let e=this._outgoingUnackMsg.toArray();for(let t=0,n=e.length;t<n;t++)this._socketWriter.write(e[t]);this._recvAckCheck()}acceptDisconnect(){this._onDidDispose.fire()}_receiveMessage(r){if(r.ack>this._outgoingAckId){this._outgoingAckId=r.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=r.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(r.type){case 0:break;case 1:{if(r.id>this._incomingMsgId)if(r.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new hn(6,0,0,Ao())))}else this._incomingMsgId=r.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(r.data);break}case 2:{this._onControlMessage.fire(r.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let t=0,n=e.length;t<n;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(r){let e=++this._outgoingMsgId;this._incomingAckId=this._incomingMsgId;let t=new hn(1,e,this._incomingAckId,r);this._outgoingUnackMsg.push(t),this._isReconnecting||(this._socketWriter.write(t),this._recvAckCheck())}sendControl(r){let e=new hn(2,0,0,r);this._socketWriter.write(e)}_sendAckCheck(){if(this._incomingMsgId<=this._incomingAckId||this._incomingAckTimeout)return;let r=Date.now()-this._incomingMsgLastTime;if(r>=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-r+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let r=this._outgoingUnackMsg.peek(),e=Date.now()-r.writtenTime,t=Date.now()-this._socketReader.lastReadTime,n=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&t>=2e4&&n>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:t});return}let i=Math.max(2e4-e,2e4-t,2e4-n,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},i)}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let r=new hn(3,0,this._incomingAckId,Ao());this._socketWriter.write(r)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let r=new hn(9,0,this._incomingAckId,Ao());this._socketWriter.write(r)}}});import{createHash as ux}from"crypto";import{createConnection as dx,createServer as JD}from"net";import{tmpdir as W5}from"os";import{createDeflateRaw as QD,createInflateRaw as XD}from"zlib";function Rf(o,r,{debugLabel:e,skipWebSocketFrames:t=!1,disableWebSocketCompression:n=!1,enableMessageSplitting:i=!0}){if(o.headers.upgrade===void 0||o.headers.upgrade.toLowerCase()!=="websocket"){r.end("HTTP/1.1 400 Bad Request");return}let s=o.headers["sec-websocket-key"],a=ux("sha1");a.update(s+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11");let c=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${a.digest("base64")}`],d=!1;if(!t&&!n&&o.headers["sec-websocket-extensions"]){let u=Array.isArray(o.headers["sec-websocket-extensions"])?o.headers["sec-websocket-extensions"]:[o.headers["sec-websocket-extensions"]];for(let f of u)if(!/\b((server_max_window_bits)|(server_no_context_takeover)|(client_no_context_takeover))\b/.test(f)){if(/\b(permessage-deflate)\b/.test(f)){d=!0,c.push("Sec-WebSocket-Extensions: permessage-deflate");break}if(/\b(x-webkit-deflate-frame)\b/.test(f)){d=!0,c.push("Sec-WebSocket-Extensions: x-webkit-deflate-frame");break}}}return r.write(c.join(`\r
`)+`\r
\r
`),r.setTimeout(0),r.setNoDelay(!0),t?new Qi(r,e):new Xv(new Qi(r,e),d,null,!0,i)}function ZD(o,r){if(r===0)return;let e=o.byteLength>>>2;for(let l=0;l<e;l++){let c=o.readUInt32BE(l*4);o.writeUInt32BE(c^r,l*4)}let t=e*4,n=o.byteLength-t,i=r>>>24&255,s=r>>>16&255,a=r>>>8&255;n>=1&&o.writeUInt8(o.readUInt8(t)^i,t),n>=2&&o.writeUInt8(o.readUInt8(t+1)^s,t+1),n>=3&&o.writeUInt8(o.readUInt8(t+2)^a,t+2)}function px(o,r,e){let n=ux("sha256").update(o).digest("hex").substr(0,8);if(process.platform==="win32")return`\\\\.\\pipe\\${n}-${e}-${r}-sock`;let i=e.substr(0,4),s=r.substr(0,6),a;return process.platform!=="darwin"&&kf&&!process.env.VSCODE_PORTABLE?a=U(kf,`vscode-${n}-${i}-${s}.sock`):a=U(o,`${i}-${s}.sock`),t2(a),a}function t2(o){let r=e2[Ni];typeof r=="number"&&o.length>=r&&console.warn(`WARNING: IPC handle "${o}" is longer than ${r} chars, try a shorter --user-data-dir`)}function fx(o){return new Promise((r,e)=>{let t=JD();t.on("error",e),t.listen(o,()=>{t.removeListener("error",e),r(new ty(t))})})}function mx(o,r){return new Promise((e,t)=>{let n,i=()=>{n.removeListener("error",t),e(Bd.fromSocket(new Qi(n,`ipc-client${r}`),r))};typeof o=="string"?n=dx(o,i):n=dx(o,i),n.once("error",t)})}var YD,Qi,Xv,Yv,Zv,ey,kf,e2,ty,Za=w(()=>{nt();Ve();Q();K();Se();Y();Mt();vi();Qv();YD=3e4,Qi=class{constructor(r,e=""){this._canWrite=!0;this.debugLabel=e,this.socket=r,this.traceSocketEvent("created",{type:"NodeSocket"}),this._errorListener=n=>{if(this.traceSocketEvent("error",{code:n?.code,message:n?.message}),n){if(n.code==="EPIPE")return;rt(n)}},this.socket.on("error",this._errorListener);let t;this._closeListener=n=>{this.traceSocketEvent("close",{hadError:n}),this._canWrite=!1,t&&clearTimeout(t)},this.socket.on("close",this._closeListener),this._endListener=()=>{this.traceSocketEvent("nodeEndReceived"),this._canWrite=!1,t=setTimeout(()=>r.destroy(),YD)},this.socket.on("end",this._endListener)}traceSocketEvent(r,e){Jv.traceSocketEvent(this.socket,this.debugLabel,r,e)}dispose(){this.socket.off("error",this._errorListener),this.socket.off("close",this._closeListener),this.socket.off("end",this._endListener),this.socket.destroy()}onData(r){let e=t=>{this.traceSocketEvent("read",t),r(H.wrap(t))};return this.socket.on("data",e),{dispose:()=>this.socket.off("data",e)}}onClose(r){let e=t=>{r({type:0,hadError:t,error:void 0})};return this.socket.on("close",e),{dispose:()=>this.socket.off("close",e)}}onEnd(r){let e=()=>{r()};return this.socket.on("end",e),{dispose:()=>this.socket.off("end",e)}}write(r){if(!(this.socket.destroyed||!this._canWrite))try{this.traceSocketEvent("write",r),this.socket.write(r.buffer,e=>{if(e){if(e.code==="EPIPE")return;rt(e)}})}catch(e){if(e.code==="EPIPE")return;rt(e)}}end(){this.traceSocketEvent("nodeEndSent"),this.socket.end()}drain(){return this.traceSocketEvent("nodeDrainBegin"),new Promise((r,e)=>{if(this.socket.bufferSize===0){this.traceSocketEvent("nodeDrainEnd"),r();return}let t=()=>{this.socket.off("close",t),this.socket.off("end",t),this.socket.off("error",t),this.socket.off("timeout",t),this.socket.off("drain",t),this.traceSocketEvent("nodeDrainEnd"),r()};this.socket.on("close",t),this.socket.on("end",t),this.socket.on("error",t),this.socket.on("timeout",t),this.socket.on("drain",t)})}},Xv=class extends C{constructor(e,t,n,i,s=!0){super();this._onData=this._register(new x);this._onClose=this._register(new x);this._isEnded=!1;this._state={state:1,readLen:2,fin:0,compressed:!1,firstFrameOfMessage:!0,mask:0,opcode:0};this.socket=e,this._maxSocketMessageLength=s?262144:1/0,this.traceSocketEvent("created",{type:"WebSocketNodeSocket",permessageDeflate:t,inflateBytesLength:n?.byteLength||0,recordInflateBytes:i}),this._flowManager=this._register(new Yv(this,t,n,i,this._onData,(a,l)=>this._write(a,l))),this._register(this._flowManager.onError(a=>{console.error(a),rt(a),this._onClose.fire({type:0,hadError:!0,error:a})})),this._incomingData=new Od,this._register(this.socket.onData(a=>this._acceptChunk(a))),this._register(this.socket.onClose(async a=>{this._flowManager.isProcessingReadQueue()&&await E.toPromise(this._flowManager.onDidFinishProcessingReadQueue),this._onClose.fire(a)}))}get permessageDeflate(){return this._flowManager.permessageDeflate}get recordedInflateBytes(){return this._flowManager.recordedInflateBytes}setRecordInflateBytes(e){this._flowManager.setRecordInflateBytes(e)}traceSocketEvent(e,t){this.socket.traceSocketEvent(e,t)}dispose(){this._flowManager.isProcessingWriteQueue()?this._register(this._flowManager.onDidFinishProcessingWriteQueue(()=>{this.dispose()})):(this.socket.dispose(),super.dispose())}onData(e){return this._onData.event(e)}onClose(e){return this._onClose.event(e)}onEnd(e){return this.socket.onEnd(e)}write(e){let t=0;for(;t<e.byteLength;)this._flowManager.writeMessage(e.slice(t,Math.min(t+this._maxSocketMessageLength,e.byteLength)),{compressed:!0,opcode:2}),t+=this._maxSocketMessageLength}_write(e,{compressed:t,opcode:n}){if(this._isEnded)return;this.traceSocketEvent("webSocketNodeSocketWrite",e);let i=2;e.byteLength<126?i+=0:e.byteLength<2**16?i+=2:i+=8;let s=H.alloc(i),a=t?64:0,l=n&15;if(s.writeUInt8(128|a|l,0),e.byteLength<126)s.writeUInt8(e.byteLength,1);else if(e.byteLength<2**16){s.writeUInt8(126,1);let c=1;s.writeUInt8(e.byteLength>>>8&255,++c),s.writeUInt8(e.byteLength>>>0&255,++c)}else{s.writeUInt8(127,1);let c=1;s.writeUInt8(0,++c),s.writeUInt8(0,++c),s.writeUInt8(0,++c),s.writeUInt8(0,++c),s.writeUInt8(e.byteLength>>>24&255,++c),s.writeUInt8(e.byteLength>>>16&255,++c),s.writeUInt8(e.byteLength>>>8&255,++c),s.writeUInt8(e.byteLength>>>0&255,++c)}this.socket.write(H.concat([s,e]))}end(){this._isEnded=!0,this.socket.end()}_acceptChunk(e){if(e.byteLength!==0){for(this._incomingData.acceptChunk(e);this._incomingData.byteLength>=this._state.readLen;)if(this._state.state===1){let t=this._incomingData.peek(this._state.readLen),n=t.readUInt8(0),i=(n&128)>>>7,s=(n&64)>>>6,a=n&15,l=t.readUInt8(1),c=(l&128)>>>7,d=l&127;this._state.state=2,this._state.readLen=2+(c?4:0)+(d===126?2:0)+(d===127?8:0),this._state.fin=i,this._state.firstFrameOfMessage&&(this._state.compressed=!!s),this._state.firstFrameOfMessage=!!i,this._state.mask=0,this._state.opcode=a,this.traceSocketEvent("webSocketNodeSocketPeekedHeader",{headerSize:this._state.readLen,compressed:this._state.compressed,fin:this._state.fin,opcode:this._state.opcode})}else if(this._state.state===2){let t=this._incomingData.read(this._state.readLen),n=t.readUInt8(1),i=(n&128)>>>7,s=n&127,a=1;s===126?s=t.readUInt8(++a)*2**8+t.readUInt8(++a):s===127&&(s=t.readUInt8(++a)*0+t.readUInt8(++a)*0+t.readUInt8(++a)*0+t.readUInt8(++a)*0+t.readUInt8(++a)*2**24+t.readUInt8(++a)*2**16+t.readUInt8(++a)*2**8+t.readUInt8(++a));let l=0;i&&(l=t.readUInt8(++a)*2**24+t.readUInt8(++a)*2**16+t.readUInt8(++a)*2**8+t.readUInt8(++a)),this._state.state=3,this._state.readLen=s,this._state.mask=l,this.traceSocketEvent("webSocketNodeSocketPeekedHeader",{bodySize:this._state.readLen,compressed:this._state.compressed,fin:this._state.fin,mask:this._state.mask,opcode:this._state.opcode})}else if(this._state.state===3){let t=this._incomingData.read(this._state.readLen);this.traceSocketEvent("webSocketNodeSocketReadData",t),ZD(t,this._state.mask),this.traceSocketEvent("webSocketNodeSocketUnmaskedData",t),this._state.state=1,this._state.readLen=2,this._state.mask=0,this._state.opcode<=2?this._flowManager.acceptFrame(t,this._state.compressed,!!this._state.fin):this._state.opcode===9&&this._flowManager.writeMessage(t,{compressed:!1,opcode:10})}}}async drain(){this.traceSocketEvent("webSocketNodeSocketDrainBegin"),this._flowManager.isProcessingWriteQueue()&&await E.toPromise(this._flowManager.onDidFinishProcessingWriteQueue),await this.socket.drain(),this.traceSocketEvent("webSocketNodeSocketDrainEnd")}},Yv=class extends C{constructor(e,t,n,i,s,a){super();this._tracer=e;this._onData=s;this._writeFn=a;this._onError=this._register(new x);this.onError=this._onError.event;this._writeQueue=[];this._readQueue=[];this._onDidFinishProcessingReadQueue=this._register(new x);this.onDidFinishProcessingReadQueue=this._onDidFinishProcessingReadQueue.event;this._onDidFinishProcessingWriteQueue=this._register(new x);this.onDidFinishProcessingWriteQueue=this._onDidFinishProcessingWriteQueue.event;this._isProcessingWriteQueue=!1;this._isProcessingReadQueue=!1;t?(this._zlibInflateStream=this._register(new Zv(this._tracer,i,n,{windowBits:15})),this._zlibDeflateStream=this._register(new ey(this._tracer,{windowBits:15})),this._register(this._zlibInflateStream.onError(l=>this._onError.fire(l))),this._register(this._zlibDeflateStream.onError(l=>this._onError.fire(l)))):(this._zlibInflateStream=null,this._zlibDeflateStream=null)}get permessageDeflate(){return!!(this._zlibInflateStream&&this._zlibDeflateStream)}get recordedInflateBytes(){return this._zlibInflateStream?this._zlibInflateStream.recordedInflateBytes:H.alloc(0)}setRecordInflateBytes(e){this._zlibInflateStream?.setRecordInflateBytes(e)}writeMessage(e,t){this._writeQueue.push({data:e,options:t}),this._processWriteQueue()}async _processWriteQueue(){if(!this._isProcessingWriteQueue){for(this._isProcessingWriteQueue=!0;this._writeQueue.length>0;){let{data:e,options:t}=this._writeQueue.shift();if(this._zlibDeflateStream&&t.compressed){let n=await this._deflateMessage(this._zlibDeflateStream,e);this._writeFn(n,t)}else this._writeFn(e,{...t,compressed:!1})}this._isProcessingWriteQueue=!1,this._onDidFinishProcessingWriteQueue.fire()}}isProcessingWriteQueue(){return this._isProcessingWriteQueue}_deflateMessage(e,t){return new Promise((n,i)=>{e.write(t),e.flush(s=>n(s))})}acceptFrame(e,t,n){this._readQueue.push({data:e,isCompressed:t,isLastFrameOfMessage:n}),this._processReadQueue()}async _processReadQueue(){if(!this._isProcessingReadQueue){for(this._isProcessingReadQueue=!0;this._readQueue.length>0;){let e=this._readQueue.shift();if(this._zlibInflateStream&&e.isCompressed){let t=await this._inflateFrame(this._zlibInflateStream,e.data,e.isLastFrameOfMessage);this._onData.fire(t)}else this._onData.fire(e.data)}this._isProcessingReadQueue=!1,this._onDidFinishProcessingReadQueue.fire()}}isProcessingReadQueue(){return this._isProcessingReadQueue}_inflateFrame(e,t,n){return new Promise((i,s)=>{e.write(t),n&&e.write(H.fromByteArray([0,0,255,255])),e.flush(a=>i(a))})}},Zv=class extends C{constructor(e,t,n,i){super();this._tracer=e;this._onError=this._register(new x);this.onError=this._onError.event;this._recordedInflateBytes=[];this._pendingInflateData=[];this._recordInflateBytes=t,this._zlibInflate=XD(i),this._zlibInflate.on("error",s=>{this._tracer.traceSocketEvent("zlibInflateError",{message:s?.message,code:s?.code}),this._onError.fire(s)}),this._zlibInflate.on("data",s=>{this._tracer.traceSocketEvent("zlibInflateData",s),this._pendingInflateData.push(H.wrap(s))}),n&&(this._tracer.traceSocketEvent("zlibInflateInitialWrite",n.buffer),this._zlibInflate.write(n.buffer),this._zlibInflate.flush(()=>{this._tracer.traceSocketEvent("zlibInflateInitialFlushFired"),this._pendingInflateData.length=0}))}get recordedInflateBytes(){return this._recordInflateBytes?H.concat(this._recordedInflateBytes):H.alloc(0)}write(e){this._recordInflateBytes&&this._recordedInflateBytes.push(e.clone()),this._tracer.traceSocketEvent("zlibInflateWrite",e),this._zlibInflate.write(e.buffer)}setRecordInflateBytes(e){this._recordInflateBytes=e,e||(this._recordedInflateBytes.length=0)}flush(e){this._zlibInflate.flush(()=>{this._tracer.traceSocketEvent("zlibInflateFlushFired");let t=H.concat(this._pendingInflateData);this._pendingInflateData.length=0,e(t)})}dispose(){this._recordedInflateBytes.length=0,this._pendingInflateData.length=0;try{this._zlibInflate.close()}catch{}super.dispose()}},ey=class extends C{constructor(e,t){super();this._tracer=e;this._onError=this._register(new x);this.onError=this._onError.event;this._pendingDeflateData=[];this._zlibDeflate=QD({windowBits:15}),this._zlibDeflate.on("error",n=>{this._tracer.traceSocketEvent("zlibDeflateError",{message:n?.message,code:n?.code}),this._onError.fire(n)}),this._zlibDeflate.on("data",n=>{this._tracer.traceSocketEvent("zlibDeflateData",n),this._pendingDeflateData.push(H.wrap(n))})}write(e){this._tracer.traceSocketEvent("zlibDeflateWrite",e.buffer),this._zlibDeflate.write(e.buffer)}flush(e){this._zlibDeflate.flush(2,()=>{this._tracer.traceSocketEvent("zlibDeflateFlushFired");let t=H.concat(this._pendingDeflateData);this._pendingDeflateData.length=0,t=t.slice(0,t.byteLength-4),e(t)})}dispose(){this._pendingDeflateData.length=0;try{this._zlibDeflate.close()}catch{}super.dispose()}};kf=process.env.XDG_RUNTIME_DIR,e2={2:107,1:103};ty=class o extends Xa{static toClientConnectionEvent(r){let e=E.fromNodeEventEmitter(r,"connection");return E.map(e,t=>({protocol:new Nd(new Qi(t,"ipc-server-connection")),onDidClientDisconnect:E.once(E.fromNodeEventEmitter(t,"close"))}))}constructor(r){super(o.toClientConnectionEvent(r)),this.server=r}dispose(){super.dispose(),this.server&&(this.server.close(),this.server=null)}}});import Vd from"electron";var ny,ct,Qn=w(()=>{Ve();ze();ny=class{constructor(){this.mapListenerToWrapper=new WeakMap}on(r,e){let t=(n,...i)=>{this.validateEvent(r,n)&&e(n,...i)};return this.mapListenerToWrapper.set(e,t),Vd.ipcMain.on(r,t),this}once(r,e){return Vd.ipcMain.once(r,(t,...n)=>{this.validateEvent(r,t)&&e(t,...n)}),this}handle(r,e){return Vd.ipcMain.handle(r,(t,...n)=>this.validateEvent(r,t)?e(t,...n):Promise.reject(`Invalid channel '${r}' or sender for ipcMain.handle() usage.`)),this}removeHandler(r){return Vd.ipcMain.removeHandler(r),this}removeListener(r,e){let t=this.mapListenerToWrapper.get(e);return t&&(Vd.ipcMain.removeListener(r,t),this.mapListenerToWrapper.delete(e)),this}validateEvent(r,e){if(!r?.startsWith("vscode:"))return rt(`Refused to handle ipcMain event for channel '${r}' because the channel is unknown.`),!1;let t=e.senderFrame,n=t?.url;if(!n||n==="about:blank")return!0;let i="unknown";try{i=new URL(n).host}catch{return rt(`Refused to handle ipcMain event for channel '${r}' because of a malformed URL '${n}'.`),!1}return process.env.VSCODE_DEV&&n===process.env.DEV_WINDOW_SRC&&(i==="localhost"||i.startsWith("localhost:"))?!0:i!==Aa?(rt(`Refused to handle ipcMain event for channel '${r}' because of a bad origin of '${i}'.`),!1):t?.parent!==null?(rt(`Refused to handle ipcMain event for channel '${r}' because sender of origin '${i}' is not a main frame.`),!1):!0}},ct=new ny});import*as Hd from"os";async function Df(){if(Mo)return;if(!M){Mo={release:Hd.release(),buildNumber:0};return}let o,r;try{let e=await import("@vscode/windows-registry"),t="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",n=e.GetStringRegKey("HKEY_LOCAL_MACHINE",t,"CurrentBuild");n!==void 0&&(o=parseInt(n,10),isNaN(o)&&(o=void 0));let i=e.GetDWORDRegKey("HKEY_LOCAL_MACHINE",t,"CurrentMajorVersionNumber"),s=e.GetDWORDRegKey("HKEY_LOCAL_MACHINE",t,"CurrentMinorVersionNumber");i!==void 0&&s!==void 0&&n!==void 0&&(r=`${i}.${s}.${n}`)}catch{}finally{Mo={release:r||Hd.release(),buildNumber:o||r2()}}}async function hx(){return Mo||await Df(),Mo.release}async function Wf(){return Mo||await Df(),Mo.buildNumber}function gx(){return Mo?.release??Hd.release()}function r2(){let o=/(\d+)\.(\d+)\.(\d+)/g.exec(Hd.release());return o&&o.length===4?parseInt(o[3],10):0}var Mo,el=w(()=>{Y()});var vx,yx,wx=w(()=>{vx="vscode:contextmenu",yx="vscode:onCloseContextMenu"});import{Menu as n2,MenuItem as iy}from"electron";function Ix(){ct.on(vx,(o,r,e,t,n)=>{let i=bx(o,t,e);i.popup({x:n?n.x:void 0,y:n?n.y:void 0,positioningItem:n?n.positioningItem:void 0,callback:()=>{i&&o.sender.send(yx,r)}})})}function bx(o,r,e){let t=new n2;return e.forEach(n=>{let i;n.type==="separator"?i=new iy({type:n.type}):Array.isArray(n.submenu)?i=new iy({submenu:bx(o,r,n.submenu),label:n.label}):i=new iy({label:n.label,type:n.type,accelerator:n.accelerator,checked:n.checked,enabled:n.enabled,visible:n.visible,click:(s,a,l)=>o.sender.send(r,n.id,l)}),t.append(i)}),t}var Sx=w(()=>{Qn();wx()});var Lf,xx=w(()=>{Lf=class{constructor(r,e){this.sender=r;this.onMessage=e}send(r){try{this.sender.send("vscode:message",r.buffer)}catch{}}disconnect(){this.sender.send("vscode:disconnect",null)}}});function Px(o,r){let e=E.fromNodeEventEmitter(ct,r,(n,i)=>({event:n,message:i})),t=E.filter(e,({event:n})=>n.sender.id===o);return E.map(t,({message:n})=>n&&H.wrap(n))}var Af,Ex=w(()=>{Qn();nt();Q();K();vi();xx();Af=class o extends Xa{static{this.Clients=new Map}static getOnDidClientConnect(){let r=E.fromNodeEventEmitter(ct,"vscode:hello",({sender:e})=>e);return E.map(r,e=>{let t=e.id;o.Clients.get(t)?.dispose();let i=new x;o.Clients.set(t,j(()=>i.fire()));let s=Px(t,"vscode:message"),a=E.any(E.signal(Px(t,"vscode:disconnect")),i.event);return{protocol:new Lf(e,s),onDidClientDisconnect:a}})}constructor(){super(o.getOnDidClientConnect())}}});var oy,Mf,Tx=w(()=>{nt();Q();vi();oy=class{constructor(r){this.port=r;this.onMessage=E.fromDOMEventEmitter(this.port,"message",e=>e.data?H.wrap(e.data):H.alloc(0)),r.start()}send(r){this.port.postMessage(r.buffer)}disconnect(){this.port.close()}},Mf=class extends Ya{constructor(r,e){let t=new oy(r);super(t,e),this.protocol=t}dispose(){this.protocol.disconnect(),super.dispose()}}});var tl,sy=w(()=>{Qn();Q();Mt();Tx();tl=class extends Mf{constructor(r,e){super({addEventListener:(t,n)=>r.addListener(t,n),removeEventListener:(t,n)=>r.removeListener(t,n),postMessage:t=>r.postMessage(t),start:()=>r.start(),close:()=>r.close()},e)}}});function rr(o){return ly(o,0)}function ly(o,r){switch(typeof o){case"object":return o===null?Xi(349,r):Array.isArray(o)?o2(o,r):s2(o,r);case"string":return _x(o,r);case"boolean":return i2(o,r);case"number":return Xi(o,r);case"undefined":return Xi(937,r);default:return Xi(617,r)}}function Xi(o,r){return(r<<5)-r+o|0}function i2(o,r){return Xi(o?433:863,r)}function _x(o,r){r=Xi(149417,r);for(let e=0,t=o.length;e<t;e++)r=Xi(o.charCodeAt(e),r);return r}function o2(o,r){return r=Xi(104579,r),o.reduce((e,t)=>ly(t,e),r)}function s2(o,r){return r=Xi(181387,r),Object.keys(o).sort().reduce((e,t)=>(e=_x(t,e),ly(o[t],e)),r)}function ay(o,r,e=32){let t=e-r,n=~((1<<t)-1);return(o<<r|(n&o)>>>t)>>>0}function Kd(o,r=32){return o instanceof ArrayBuffer?nx(H.wrap(new Uint8Array(o))):(o>>>0).toString(16).padStart(r/4,"0")}var Cx,yi=w(()=>{nt();dr();Cx=class o{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(r){let e=r.length;if(e===0)return;let t=this._buff,n=this._buffLen,i=this._leftoverHighSurrogate,s,a;for(i!==0?(s=i,a=-1,i=0):(s=r.charCodeAt(0),a=0);;){let l=s;if(qS(s))if(a+1<e){let c=r.charCodeAt(a+1);yv(c)?(a++,l=zS(s,c)):l=65533}else{i=s;break}else yv(s)&&(l=65533);if(n=this._push(t,n,l),a++,a<e)s=r.charCodeAt(a);else break}this._buffLen=n,this._leftoverHighSurrogate=i}_push(r,e,t){return t<128?r[e++]=t:t<2048?(r[e++]=192|(t&1984)>>>6,r[e++]=128|(t&63)>>>0):t<65536?(r[e++]=224|(t&61440)>>>12,r[e++]=128|(t&4032)>>>6,r[e++]=128|(t&63)>>>0):(r[e++]=240|(t&1835008)>>>18,r[e++]=128|(t&258048)>>>12,r[e++]=128|(t&4032)>>>6,r[e++]=128|(t&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,r[0]=r[64],r[1]=r[65],r[2]=r[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()),Kd(this._h0)+Kd(this._h1)+Kd(this._h2)+Kd(this._h3)+Kd(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 r=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(r/4294967296),!1),this._buffDV.setUint32(60,r%4294967296,!1),this._step()}_step(){let r=o._bigBlock32,e=this._buffDV;for(let u=0;u<64;u+=4)r.setUint32(u,e.getUint32(u,!1),!1);for(let u=64;u<320;u+=4)r.setUint32(u,ay(r.getUint32(u-12,!1)^r.getUint32(u-32,!1)^r.getUint32(u-56,!1)^r.getUint32(u-64,!1),1),!1);let t=this._h0,n=this._h1,i=this._h2,s=this._h3,a=this._h4,l,c,d;for(let u=0;u<80;u++)u<20?(l=n&i|~n&s,c=1518500249):u<40?(l=n^i^s,c=1859775393):u<60?(l=n&i|n&s|i&s,c=2400959708):(l=n^i^s,c=3395469782),d=ay(t,5)+l+a+c+r.getUint32(u*4,!1)&4294967295,a=s,s=i,i=ay(n,30),n=t,t=d;this._h0=this._h0+t&4294967295,this._h1=this._h1+n&4294967295,this._h2=this._h2+i&4294967295,this._h3=this._h3+s&4294967295,this._h4=this._h4+a&4294967295}}});var AN,$d,Of=w(()=>{Z();AN=W("encryptionService"),$d=W("encryptionMainService")});var $r,fr,qr=w(()=>{Z();$r=W("environmentService"),fr=$r});function kx(o){return o.getFullYear()+"-"+String(o.getMonth()+1).padStart(2,"0")+"-"+String(o.getDate()).padStart(2,"0")+"T"+String(o.getHours()).padStart(2,"0")+":"+String(o.getMinutes()).padStart(2,"0")+":"+String(o.getSeconds()).padStart(2,"0")+"."+(o.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var a2,l2,cy,VN,HN,KN,Rx=w(()=>{Ce();xo();Y();a2=60,l2=a2*60,cy=l2*24,VN=cy*7,HN=cy*30,KN=cy*365});function c2(o,r){return Uf(o["inspect-extensions"],o["inspect-brk-extensions"],5870,r,o.debugId,o.extensionEnvironment)}function Uf(o,r,e,t,n,i){let a=Number(r||o)||(t?null:e),l=a?!!r:!1,c;if(i)try{c=JSON.parse(i)}catch{}return{port:a,break:l,debugId:n,env:c}}var Dx,Ke,Wx=w(()=>{Rx();Wo();ze();Se();Bn();yt();se();Dx=/^([^.]+\..+)[:=](.+)$/,Ke=class{constructor(r,e,t){this._args=r;this.paths=e;this.productService=t}get appRoot(){return $e(et.asFileUri("").fsPath)}get userHome(){return b.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return b.file(U(this.userDataPath,"User"))}get tmpDir(){return b.file(this.paths.tmpDir)}get cacheHome(){return b.file(this.userDataPath)}get stateResource(){return fe(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:N.vscodeUserData})}get userDataSyncHome(){return fe(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let r=kx(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=U(this.userDataPath,"logs",r)}return b.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return fe(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return fe(this.appSettingsHome,"History")}get keyboardLayoutResource(){return fe(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let r=Sr.VSCODE_PORTABLE;return r?b.file(U(r,"argv.json")):fe(this.userHome,this.productService.dataFolderName,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return b.file(U(this.userDataPath,"Workspaces"))}get builtinWorkbenchModesHome(){return fe(b.file(this.appRoot),"resources","workbenchModes")}get builtinExtensionsPath(){let r=this.args["builtin-extensions-dir"];return r?It(r):kt(U(et.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let r=this.args["extensions-download-dir"];return r?b.file(It(r)):b.file(U(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let r=this.args["extensions-dir"];if(r)return It(r);let e=Sr.VSCODE_EXTENSIONS;if(e)return e;let t=Sr.VSCODE_PORTABLE;return t?U(t,"extensions"):fe(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get extensionDevelopmentLocationURI(){let r=this.args.extensionDevelopmentPath;if(Array.isArray(r))return r.map(e=>/^[^:/?#]+?:\/\//.test(e)?b.parse(e):b.file(kt(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(r=>r==="ui"||r==="workspace"||r==="web"?r:"workspace")}get extensionTestsLocationURI(){let r=this.args.extensionTestsPath;if(r)return/^[^:/?#]+?:\/\//.test(r)?b.parse(r):b.file(kt(r))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let r=this.args["disable-extension"];if(r){if(typeof r=="string")return[r];if(Array.isArray(r)&&r.length>0)return r}return!1}get debugExtensionHost(){return c2(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!Sr.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(r=>!Dx.test(r))}get extensionLogLevel(){let r=[];for(let e of this.args.log||[]){let t=Dx.exec(e);t?.[1]&&t[2]&&r.push([t[1],t[2]])}return r.length?r:void 0}get serviceMachineIdResource(){return fe(b.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 r=Sr.VSCODE_PORTABLE;return r?b.file(U(r,"policy.json")):fe(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return fe(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(r){this.args.continueOn=r}get args(){return this._args}};T([de],Ke.prototype,"appRoot",1),T([de],Ke.prototype,"userHome",1),T([de],Ke.prototype,"userDataPath",1),T([de],Ke.prototype,"appSettingsHome",1),T([de],Ke.prototype,"tmpDir",1),T([de],Ke.prototype,"cacheHome",1),T([de],Ke.prototype,"stateResource",1),T([de],Ke.prototype,"userRoamingDataHome",1),T([de],Ke.prototype,"userDataSyncHome",1),T([de],Ke.prototype,"sync",1),T([de],Ke.prototype,"workspaceStorageHome",1),T([de],Ke.prototype,"localHistoryHome",1),T([de],Ke.prototype,"keyboardLayoutResource",1),T([de],Ke.prototype,"argvResource",1),T([de],Ke.prototype,"isExtensionDevelopment",1),T([de],Ke.prototype,"untitledWorkspacesHome",1),T([de],Ke.prototype,"builtinWorkbenchModesHome",1),T([de],Ke.prototype,"builtinExtensionsPath",1),T([de],Ke.prototype,"extensionsDownloadLocation",1),T([de],Ke.prototype,"extensionsPath",1),T([de],Ke.prototype,"extensionDevelopmentLocationURI",1),T([de],Ke.prototype,"extensionDevelopmentKind",1),T([de],Ke.prototype,"extensionTestsLocationURI",1),T([de],Ke.prototype,"debugExtensionHost",1),T([de],Ke.prototype,"logLevel",1),T([de],Ke.prototype,"extensionLogLevel",1),T([de],Ke.prototype,"serviceMachineIdResource",1),T([de],Ke.prototype,"disableTelemetry",1),T([de],Ke.prototype,"disableExperiments",1),T([de],Ke.prototype,"disableWorkspaceTrust",1),T([de],Ke.prototype,"useInMemorySecretStorage",1),T([de],Ke.prototype,"policyFile",1),T([de],Ke.prototype,"agentSessionsWorkspace",1)});import{homedir as d2,tmpdir as u2}from"os";function Lx(o,r){return Uf(o["inspect-ptyhost"],o["inspect-brk-ptyhost"],5877,r,o.extensionEnvironment)}function Ax(o,r){return Uf(o["inspect-sharedprocess"],o["inspect-brk-sharedprocess"],5879,r,o.extensionEnvironment)}var Nf,Bf=w(()=>{Wx();qg();Nf=class extends Ke{constructor(r,e){super(r,{homeDir:d2(),tmpDir:u2(),userDataDir:Ep(r,e.nameShort)},e)}}});var Te,gn,Ot=w(()=>{Wo();Se();Y();Za();qr();Bf();Z();Te=$r,gn=class extends Nf{constructor(){super(...arguments);this._snapEnv={}}get backupHome(){return U(this.userDataPath,"Backups")}get mainIPCHandle(){return px(this.userDataPath,"main",this.productService.version)}get mainLockfile(){return U(this.userDataPath,"code.lock")}get disableUpdates(){return!!this.args["disable-updates"]}get isPortable(){return!!process.env.VSCODE_PORTABLE}get crossOriginIsolated(){return!!this.args["enable-coi"]}get enableRDPDisplayTracking(){return!!this.args["enable-rdp-display-tracking"]}get codeCachePath(){return process.env.VSCODE_CODE_CACHE_PATH||void 0}get useCodeCache(){return!!this.codeCachePath}unsetSnapExportedVariables(){if(ne){for(let e in process.env)if(e.endsWith("_VSCODE_SNAP_ORIG")){let t=e.slice(0,-17);if(this._snapEnv[t])continue;process.env[t]&&(this._snapEnv[t]=process.env[t]),process.env[e]?process.env[t]=process.env[e]:delete process.env[t]}}}restoreSnapExportedVariables(){if(ne)for(let e in this._snapEnv)process.env[e]=this._snapEnv[e],delete this._snapEnv[e]}};T([de],gn.prototype,"backupHome",1),T([de],gn.prototype,"mainIPCHandle",1),T([de],gn.prototype,"mainLockfile",1),T([de],gn.prototype,"disableUpdates",1),T([de],gn.prototype,"isPortable",1),T([de],gn.prototype,"crossOriginIsolated",1),T([de],gn.prototype,"enableRDPDisplayTracking",1),T([de],gn.prototype,"codeCachePath",1),T([de],gn.prototype,"useCodeCache",1)});function dy(...o){switch(o.length){case 1:return h(1877,null,o[0]);case 2:return h(1878,null,o[0],o[1]);case 3:return h(1879,null,o[0],o[1],o[2]);default:return}}var p2,f2,Oo,Mx=w(()=>{Kn();Ve();Ce();p2=h(1876,null),f2=h(1875,null),Oo=class o{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(r){switch(r.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return r.isTripleEq?"===":"==";case 4:return r.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return r.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 r.lexeme;case 18:return r.lexeme;case 19:return r.lexeme;case 20:return"EOF";default:throw Vp(`unhandled token type: ${JSON.stringify(r)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(r=>r.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(r){return this._input=r,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(dy("==","=~"));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(dy("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(dy("||"));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(r){return this._isAtEnd()||this._input.charCodeAt(this._current)!==r?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(r){this._tokens.push({type:r,offset:this._start})}_error(r){let e=this._start,t=this._input.substring(this._start,this._current),n={type:19,offset:this._start,lexeme:t};this._errors.push({offset:e,lexeme:t,additionalInfo:r}),this._tokens.push(n)}_string(){this.stringRe.lastIndex=this._start;let r=this.stringRe.exec(this._input);if(r){this._current=this._start+r[0].length;let e=this._input.substring(this._start,this._current),t=o._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(p2);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let r=this._current,e=!1,t=!1;for(;;){if(r>=this._input.length){this._current=r,this._error(f2);return}let i=this._input.charCodeAt(r);if(e)e=!1;else if(i===47&&!t){r++;break}else i===91?t=!0:i===92?e=!0:i===93&&(t=!1);r++}for(;r<this._input.length&&o._regexFlags.has(this._input.charCodeAt(r));)r++;this._current=r;let n=this._input.substring(this._start,this._current);this._tokens.push({type:10,lexeme:n,offset:this._start})}_isAtEnd(){return this._current>=this._input.length}}});function qd(o,r){return o.cmp(r)}function qf(o,r){if(typeof o=="string"){let e=parseFloat(o);isNaN(e)||(o=e)}return typeof o=="string"||typeof o=="number"?r(o):Cr.INSTANCE}function Ux(o){let r=null;for(let e=0,t=o.length;e<t;e++){let n=o[e].substituteConstants();if(o[e]!==n&&r===null){r=[];for(let i=0;i<e;i++)r[i]=o[i]}r!==null&&(r[e]=n)}return r===null?o:r}function Nx(o,r){return o<r?-1:o>r?1:0}function Fs(o,r,e,t){return o<e?-1:o>e?1:r<t?-1:r>t?1:0}function Fx(o){return o.type===9?o.expr:[o]}var nr,m2,h2,g2,v2,y2,Ox,w2,I2,b2,S2,uy,mr,Cr,Mr,Ms,zd,Vf,Hf,Gd,Os,rl,jd,Jd,Qd,Xd,py,Kf,Yd,$f,k7,Bx=w(()=>{Kn();Y();dr();Mx();Z();Ce();Ve();nr=new Map;nr.set("false",!1);nr.set("true",!0);nr.set("isMac",V);nr.set("isLinux",ne);nr.set("isWindows",M);nr.set("isWeb",Dr);nr.set("isMacNative",V&&!Dr);nr.set("isEdge",eS);nr.set("isFirefox",Yb);nr.set("isChrome",Qg);nr.set("isSafari",Zb);m2=Object.prototype.hasOwnProperty,h2={regexParsingWithErrorRecovery:!0},g2=h(1856,null),v2=h(1857,null),y2=h(1859,null),Ox=h(1855,null),w2=h(1862,null),I2=h(1863,null),b2=h(1860,null),S2=h(1861,null),uy=class o{constructor(r=h2){this._config=r;this._scanner=new Oo;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(r){if(r===""){this._parsingErrors.push({message:g2,offset:0,lexeme:"",additionalInfo:v2});return}this._tokens=this._scanner.reset(r).scan(),this._current=0,this._parsingErrors=[];try{let e=this._expr();if(!this._isAtEnd()){let t=this._peek(),n=t.type===17?I2:void 0;throw this._parsingErrors.push({message:w2,offset:t.offset,lexeme:Oo.getLexeme(t),additionalInfo:n}),o._parseError}return e}catch(e){if(e!==o._parseError)throw e;return}}_expr(){return this._or()}_or(){let r=[this._and()];for(;this._matchOne(16);){let e=this._and();r.push(e)}return r.length===1?r[0]:mr.or(...r)}_and(){let r=[this._term()];for(;this._matchOne(15);){let e=this._term();r.push(e)}return r.length===1?r[0]:mr.and(...r)}_term(){if(this._matchOne(2)){let r=this._peek();switch(r.type){case 11:return this._advance(),Cr.INSTANCE;case 12:return this._advance(),Mr.INSTANCE;case 0:{this._advance();let e=this._expr();return this._consume(1,Ox),e?.negate()}case 17:return this._advance(),Os.create(r.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",r)}}return this._primary()}_primary(){let r=this._peek();switch(r.type){case 11:return this._advance(),mr.true();case 12:return this._advance(),mr.false();case 0:{this._advance();let e=this._expr();return this._consume(1,Ox),e}case 17:{let e=r.lexeme;if(this._advance(),this._matchOne(9)){let n=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),n.type!==10)throw this._errExpectedButGot("REGEX",n);let i=n.lexeme,s=i.lastIndexOf("/"),a=s===i.length-1?void 0:this._removeFlagsGY(i.substring(s+1)),l;try{l=new RegExp(i.substring(1,s),a)}catch{throw this._errExpectedButGot("REGEX",n)}return Xd.create(e,l)}switch(n.type){case 10:case 19:{let i=[n.lexeme];this._advance();let s=this._peek(),a=0;for(let f=0;f<n.lexeme.length;f++)n.lexeme.charCodeAt(f)===40?a++:n.lexeme.charCodeAt(f)===41&&a--;for(;!this._isAtEnd()&&s.type!==15&&s.type!==16;){switch(s.type){case 0:a++;break;case 1:a--;break;case 10:case 18:for(let f=0;f<s.lexeme.length;f++)s.lexeme.charCodeAt(f)===40?a++:n.lexeme.charCodeAt(f)===41&&a--}if(a<0)break;i.push(Oo.getLexeme(s)),this._advance(),s=this._peek()}let l=i.join(""),c=l.lastIndexOf("/"),d=c===l.length-1?void 0:this._removeFlagsGY(l.substring(c+1)),u;try{u=new RegExp(l.substring(1,c),d)}catch{throw this._errExpectedButGot("REGEX",n)}return mr.regex(e,u)}case 18:{let i=n.lexeme;this._advance();let s=null;if(!KS(i)){let a=i.indexOf("/"),l=i.lastIndexOf("/");if(a!==l&&a>=0){let c=i.slice(a+1,l),d=i[l+1]==="i"?"i":"";try{s=new RegExp(c,d)}catch{throw this._errExpectedButGot("REGEX",n)}}}if(s===null)throw this._errExpectedButGot("REGEX",n);return Xd.create(e,s)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,y2);let n=this._value();return mr.notIn(e,n)}switch(this._peek().type){case 3:{this._advance();let n=this._value();if(this._previous().type===18)return mr.equals(e,n);switch(n){case"true":return mr.has(e);case"false":return mr.not(e);default:return mr.equals(e,n)}}case 4:{this._advance();let n=this._value();if(this._previous().type===18)return mr.notEquals(e,n);switch(n){case"true":return mr.not(e);case"false":return mr.has(e);default:return mr.notEquals(e,n)}}case 5:return this._advance(),Jd.create(e,this._value());case 6:return this._advance(),Qd.create(e,this._value());case 7:return this._advance(),rl.create(e,this._value());case 8:return this._advance(),jd.create(e,this._value());case 13:return this._advance(),mr.in(e,this._value());default:return mr.has(e)}}case 20:throw this._parsingErrors.push({message:b2,offset:r.offset,lexeme:"",additionalInfo:S2}),o._parseError;default:throw this._errExpectedButGot(`true | false | KEY 
	| KEY '=~' REGEX 
	| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let r=this._peek();switch(r.type){case 17:case 18:return this._advance(),r.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(r){return r.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(r){return this._check(r)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(r,e){if(this._check(r))return this._advance();throw this._errExpectedButGot(e,this._peek())}_errExpectedButGot(r,e,t){let n=h(1858,null,r,Oo.getLexeme(e)),i=e.offset,s=Oo.getLexeme(e);return this._parsingErrors.push({message:n,offset:i,lexeme:s,additionalInfo:t}),o._parseError}_check(r){return this._peek().type===r}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},mr=class{static false(){return Cr.INSTANCE}static true(){return Mr.INSTANCE}static has(r){return Ms.create(r)}static equals(r,e){return zd.create(r,e)}static notEquals(r,e){return Gd.create(r,e)}static regex(r,e){return Xd.create(r,e)}static in(r,e){return Vf.create(r,e)}static notIn(r,e){return Hf.create(r,e)}static not(r){return Os.create(r)}static and(...r){return Kf.create(r,null,!0)}static or(...r){return Yd.create(r,null,!0)}static greater(r,e){return rl.create(r,e)}static greaterEquals(r,e){return jd.create(r,e)}static smaller(r,e){return Jd.create(r,e)}static smallerEquals(r,e){return Qd.create(r,e)}static{this._parser=new uy({regexParsingWithErrorRecovery:!1})}static deserialize(r){return r==null?void 0:this._parser.parse(r)}};Cr=class o{constructor(){this.type=0}static{this.INSTANCE=new o}cmp(r){return this.type-r.type}equals(r){return r.type===this.type}substituteConstants(){return this}evaluate(r){return!1}serialize(){return"false"}keys(){return[]}map(r){return this}negate(){return Mr.INSTANCE}},Mr=class o{constructor(){this.type=1}static{this.INSTANCE=new o}cmp(r){return this.type-r.type}equals(r){return r.type===this.type}substituteConstants(){return this}evaluate(r){return!0}serialize(){return"true"}keys(){return[]}map(r){return this}negate(){return Cr.INSTANCE}},Ms=class o{constructor(r,e){this.key=r;this.negated=e;this.type=2}static create(r,e=null){let t=nr.get(r);return typeof t=="boolean"?t?Mr.INSTANCE:Cr.INSTANCE:new o(r,e)}cmp(r){return r.type!==this.type?this.type-r.type:Nx(this.key,r.key)}equals(r){return r.type===this.type?this.key===r.key:!1}substituteConstants(){let r=nr.get(this.key);return typeof r=="boolean"?r?Mr.INSTANCE:Cr.INSTANCE:this}evaluate(r){return!!r.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(r){return r.mapDefined(this.key)}negate(){return this.negated||(this.negated=Os.create(this.key,this)),this.negated}},zd=class o{constructor(r,e,t){this.key=r;this.value=e;this.negated=t;this.type=4}static create(r,e,t=null){if(typeof e=="boolean")return e?Ms.create(r,t):Os.create(r,t);let n=nr.get(r);return typeof n=="boolean"?e===(n?"true":"false")?Mr.INSTANCE:Cr.INSTANCE:new o(r,e,t)}cmp(r){return r.type!==this.type?this.type-r.type:Fs(this.key,this.value,r.key,r.value)}equals(r){return r.type===this.type?this.key===r.key&&this.value===r.value:!1}substituteConstants(){let r=nr.get(this.key);if(typeof r=="boolean"){let e=r?"true":"false";return this.value===e?Mr.INSTANCE:Cr.INSTANCE}return this}evaluate(r){return r.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(r){return r.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Gd.create(this.key,this.value,this)),this.negated}},Vf=class o{constructor(r,e){this.key=r;this.valueKey=e;this.type=10;this.negated=null}static create(r,e){return new o(r,e)}cmp(r){return r.type!==this.type?this.type-r.type:Fs(this.key,this.valueKey,r.key,r.valueKey)}equals(r){return r.type===this.type?this.key===r.key&&this.valueKey===r.valueKey:!1}substituteConstants(){return this}evaluate(r){let e=r.getValue(this.valueKey),t=r.getValue(this.key);if(Array.isArray(e)){if(e.includes(t))return!0;if(M&&typeof t=="string"&&t.startsWith("file:///")){let n=t.toLowerCase();return e.some(i=>typeof i=="string"&&i.toLowerCase()===n)}return!1}if(typeof t=="string"&&typeof e=="object"&&e!==null){if(m2.call(e,t))return!0;if(M&&t.startsWith("file:///")){let n=t.toLowerCase();return Object.keys(e).some(i=>i.toLowerCase()===n)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(r){return r.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Hf.create(this.key,this.valueKey)),this.negated}},Hf=class o{constructor(r,e){this.key=r;this.valueKey=e;this.type=11;this._negated=Vf.create(r,e)}static create(r,e){return new o(r,e)}cmp(r){return r.type!==this.type?this.type-r.type:this._negated.cmp(r._negated)}equals(r){return r.type===this.type?this._negated.equals(r._negated):!1}substituteConstants(){return this}evaluate(r){return!this._negated.evaluate(r)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(r){return r.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},Gd=class o{constructor(r,e,t){this.key=r;this.value=e;this.negated=t;this.type=5}static create(r,e,t=null){if(typeof e=="boolean")return e?Os.create(r,t):Ms.create(r,t);let n=nr.get(r);return typeof n=="boolean"?e===(n?"true":"false")?Cr.INSTANCE:Mr.INSTANCE:new o(r,e,t)}cmp(r){return r.type!==this.type?this.type-r.type:Fs(this.key,this.value,r.key,r.value)}equals(r){return r.type===this.type?this.key===r.key&&this.value===r.value:!1}substituteConstants(){let r=nr.get(this.key);if(typeof r=="boolean"){let e=r?"true":"false";return this.value===e?Cr.INSTANCE:Mr.INSTANCE}return this}evaluate(r){return r.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(r){return r.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=zd.create(this.key,this.value,this)),this.negated}},Os=class o{constructor(r,e){this.key=r;this.negated=e;this.type=3}static create(r,e=null){let t=nr.get(r);return typeof t=="boolean"?t?Cr.INSTANCE:Mr.INSTANCE:new o(r,e)}cmp(r){return r.type!==this.type?this.type-r.type:Nx(this.key,r.key)}equals(r){return r.type===this.type?this.key===r.key:!1}substituteConstants(){let r=nr.get(this.key);return typeof r=="boolean"?r?Cr.INSTANCE:Mr.INSTANCE:this}evaluate(r){return!r.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(r){return r.mapNot(this.key)}negate(){return this.negated||(this.negated=Ms.create(this.key,this)),this.negated}};rl=class o{constructor(r,e,t){this.key=r;this.value=e;this.negated=t;this.type=12}static create(r,e,t=null){return qf(e,n=>new o(r,n,t))}cmp(r){return r.type!==this.type?this.type-r.type:Fs(this.key,this.value,r.key,r.value)}equals(r){return r.type===this.type?this.key===r.key&&this.value===r.value:!1}substituteConstants(){return this}evaluate(r){return typeof this.value=="string"?!1:parseFloat(r.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(r){return r.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=Qd.create(this.key,this.value,this)),this.negated}},jd=class o{constructor(r,e,t){this.key=r;this.value=e;this.negated=t;this.type=13}static create(r,e,t=null){return qf(e,n=>new o(r,n,t))}cmp(r){return r.type!==this.type?this.type-r.type:Fs(this.key,this.value,r.key,r.value)}equals(r){return r.type===this.type?this.key===r.key&&this.value===r.value:!1}substituteConstants(){return this}evaluate(r){return typeof this.value=="string"?!1:parseFloat(r.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(r){return r.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=Jd.create(this.key,this.value,this)),this.negated}},Jd=class o{constructor(r,e,t){this.key=r;this.value=e;this.negated=t;this.type=14}static create(r,e,t=null){return qf(e,n=>new o(r,n,t))}cmp(r){return r.type!==this.type?this.type-r.type:Fs(this.key,this.value,r.key,r.value)}equals(r){return r.type===this.type?this.key===r.key&&this.value===r.value:!1}substituteConstants(){return this}evaluate(r){return typeof this.value=="string"?!1:parseFloat(r.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}map(r){return r.mapSmaller(this.key,this.value)}negate(){return this.negated||(this.negated=jd.create(this.key,this.value,this)),this.negated}},Qd=class o{constructor(r,e,t){this.key=r;this.value=e;this.negated=t;this.type=15}static create(r,e,t=null){return qf(e,n=>new o(r,n,t))}cmp(r){return r.type!==this.type?this.type-r.type:Fs(this.key,this.value,r.key,r.value)}equals(r){return r.type===this.type?this.key===r.key&&this.value===r.value:!1}substituteConstants(){return this}evaluate(r){return typeof this.value=="string"?!1:parseFloat(r.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(r){return r.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=rl.create(this.key,this.value,this)),this.negated}},Xd=class o{constructor(r,e){this.key=r;this.regexp=e;this.type=7;this.negated=null}static create(r,e){return new o(r,e)}cmp(r){if(r.type!==this.type)return this.type-r.type;if(this.key<r.key)return-1;if(this.key>r.key)return 1;let e=this.regexp?this.regexp.source:"",t=r.regexp?r.regexp.source:"";return e<t?-1:e>t?1:0}equals(r){if(r.type===this.type){let e=this.regexp?this.regexp.source:"",t=r.regexp?r.regexp.source:"";return this.key===r.key&&e===t}return!1}substituteConstants(){return this}evaluate(r){let e=r.getValue(this.key);return this.regexp?this.regexp.test(e):!1}serialize(){let r=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${r}`}keys(){return[this.key]}map(r){return r.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=py.create(this)),this.negated}},py=class o{constructor(r){this._actual=r;this.type=8}static create(r){return new o(r)}cmp(r){return r.type!==this.type?this.type-r.type:this._actual.cmp(r._actual)}equals(r){return r.type===this.type?this._actual.equals(r._actual):!1}substituteConstants(){return this}evaluate(r){return!this._actual.evaluate(r)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(r){return new o(this._actual.map(r))}negate(){return this._actual}};Kf=class o{constructor(r,e){this.expr=r;this.negated=e;this.type=6}static create(r,e,t){return o._normalizeArr(r,e,t)}cmp(r){if(r.type!==this.type)return this.type-r.type;if(this.expr.length<r.expr.length)return-1;if(this.expr.length>r.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let n=qd(this.expr[e],r.expr[e]);if(n!==0)return n}return 0}equals(r){if(r.type===this.type){if(this.expr.length!==r.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(r.expr[e]))return!1;return!0}return!1}substituteConstants(){let r=Ux(this.expr);return r===this.expr?this:o.create(r,this.negated,!1)}evaluate(r){for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].evaluate(r))return!1;return!0}static _normalizeArr(r,e,t){let n=[],i=!1;for(let s of r)if(s){if(s.type===1){i=!0;continue}if(s.type===0)return Cr.INSTANCE;if(s.type===6){n.push(...s.expr);continue}n.push(s)}if(n.length===0&&i)return Mr.INSTANCE;if(n.length!==0){if(n.length===1)return n[0];n.sort(qd);for(let s=1;s<n.length;s++)n[s-1].equals(n[s])&&(n.splice(s,1),s--);if(n.length===1)return n[0];for(;n.length>1;){let s=n[n.length-1];if(s.type!==9)break;n.pop();let a=n.pop(),l=n.length===0,c=Yd.create(s.expr.map(d=>o.create([d,a],null,t)),null,l);c&&(n.push(c),n.sort(qd))}if(n.length===1)return n[0];if(t){for(let s=0;s<n.length;s++)for(let a=s+1;a<n.length;a++)if(n[s].negate().equals(n[a]))return Cr.INSTANCE;if(n.length===1)return n[0]}return new o(n,e)}}serialize(){return this.expr.map(r=>r.serialize()).join(" && ")}keys(){let r=[];for(let e of this.expr)r.push(...e.keys());return r}map(r){return new o(this.expr.map(e=>e.map(r)),null)}negate(){if(!this.negated){let r=[];for(let e of this.expr)r.push(e.negate());this.negated=Yd.create(r,this,!0)}return this.negated}},Yd=class o{constructor(r,e){this.expr=r;this.negated=e;this.type=9}static create(r,e,t){return o._normalizeArr(r,e,t)}cmp(r){if(r.type!==this.type)return this.type-r.type;if(this.expr.length<r.expr.length)return-1;if(this.expr.length>r.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let n=qd(this.expr[e],r.expr[e]);if(n!==0)return n}return 0}equals(r){if(r.type===this.type){if(this.expr.length!==r.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(r.expr[e]))return!1;return!0}return!1}substituteConstants(){let r=Ux(this.expr);return r===this.expr?this:o.create(r,this.negated,!1)}evaluate(r){for(let e=0,t=this.expr.length;e<t;e++)if(this.expr[e].evaluate(r))return!0;return!1}static _normalizeArr(r,e,t){let n=[],i=!1;if(r){for(let s=0,a=r.length;s<a;s++){let l=r[s];if(l){if(l.type===0){i=!0;continue}if(l.type===1)return Mr.INSTANCE;if(l.type===9){n=n.concat(l.expr);continue}n.push(l)}}if(n.length===0&&i)return Cr.INSTANCE;n.sort(qd)}if(n.length!==0){if(n.length===1)return n[0];for(let s=1;s<n.length;s++)n[s-1].equals(n[s])&&(n.splice(s,1),s--);if(n.length===1)return n[0];if(t){for(let s=0;s<n.length;s++)for(let a=s+1;a<n.length;a++)if(n[s].negate().equals(n[a]))return Mr.INSTANCE;if(n.length===1)return n[0]}return new o(n,e)}}serialize(){return this.expr.map(r=>r.serialize()).join(" || ")}keys(){let r=[];for(let e of this.expr)r.push(...e.keys());return r}map(r){return new o(this.expr.map(e=>e.map(r)),null)}negate(){if(!this.negated){let r=[];for(let e of this.expr)r.push(e.negate());for(;r.length>1;){let e=r.shift(),t=r.shift(),n=[];for(let i of Fx(e))for(let s of Fx(t))n.push(Kf.create([i,s],null,!1));r.unshift(o.create(n,null,!1))}this.negated=o.create(r,this,!0)}return this.negated}},$f=class o extends Ms{static{this._info=[]}static all(){return o._info.values()}constructor(r,e,t){super(r,null),this._defaultValue=e,typeof t=="object"?o._info.push({...t,key:r}):t!==!0&&o._info.push({key:r,description:t,type:e!=null?typeof e:void 0})}bindTo(r){return r.createKey(this.key,this._defaultValue)}getValue(r){return r.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(r){return zd.create(this.key,r)}notEqualsTo(r){return Gd.create(this.key,r)}greater(r){return rl.create(this.key,r)}},k7=W("contextKeyService")});function wi(){return new Date().toISOString()}function tu(o){return Hn(o)}function x2(o,r){return o!==0&&o<=r}function nu(o,r,e){switch(r){case 1:o.trace(e);break;case 2:o.debug(e);break;case 3:o.info(e);break;case 4:o.warn(e);break;case 5:o.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${r}`)}}function nl(o,r=!1){let e="";for(let t=0;t<o.length;t++){let n=o[t];if(n instanceof Error&&(n=Tr(n,r)),typeof n=="object")try{n=JSON.stringify(n)}catch{}e+=(t>0?" ":"")+n}return e}function Vx(o){if(o.verbose)return 1;if(typeof o.logLevel=="string"){let r=E2(o.logLevel.toLowerCase());if(r!==void 0)return r}return ru}function P2(o){switch(o){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 E2(o){switch(o){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 O,Fo,ru,Zd,Us,zf,Gf,eu,fy,jf,q7,re=w(()=>{Ce();Ro();Q();yi();K();Lr();Y();yt();We();se();Bx();Z();O=W("logService"),Fo=W("loggerService");ru=3;Zd=class extends C{constructor(){super(...arguments);this.level=ru;this._onDidChangeLogLevel=this._register(new x)}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 x2(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}},Us=class extends Zd{constructor(e){super();this.logAlways=e}checkLogLevel(e){return this.logAlways||super.checkLogLevel(e)}trace(e,...t){this.canLog(1)&&this.log(1,nl([e,...t],!0))}debug(e,...t){this.canLog(2)&&this.log(2,nl([e,...t]))}info(e,...t){this.canLog(3)&&this.log(3,nl([e,...t]))}warn(e,...t){this.canLog(4)&&this.log(4,nl([e,...t]))}error(e,...t){if(this.canLog(5))if(e instanceof Error){let n=Array.prototype.slice.call(arguments);n[0]=e.stack,this.log(5,nl(n))}else this.log(5,nl([e,...t]))}flush(){}},zf=class extends Zd{constructor(r=ru){super(),this.setLevel(r),this.useColors=!M}trace(r,...e){this.canLog(1)&&(this.useColors?console.log(`\x1B[90m[main ${wi()}]\x1B[0m`,r,...e):console.log(`[main ${wi()}]`,r,...e))}debug(r,...e){this.canLog(2)&&(this.useColors?console.log(`\x1B[90m[main ${wi()}]\x1B[0m`,r,...e):console.log(`[main ${wi()}]`,r,...e))}info(r,...e){this.canLog(3)&&(this.useColors?console.log(`\x1B[90m[main ${wi()}]\x1B[0m`,r,...e):console.log(`[main ${wi()}]`,r,...e))}warn(r,...e){this.canLog(4)&&(this.useColors?console.warn(`\x1B[93m[main ${wi()}]\x1B[0m`,r,...e):console.warn(`[main ${wi()}]`,r,...e))}error(r,...e){this.canLog(5)&&(this.useColors?console.error(`\x1B[91m[main ${wi()}]\x1B[0m`,r,...e):console.error(`[main ${wi()}]`,r,...e))}flush(){}},Gf=class extends Zd{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 n of this.loggers)n.trace(e,...t)}debug(e,...t){for(let n of this.loggers)n.debug(e,...t)}info(e,...t){for(let n of this.loggers)n.info(e,...t)}warn(e,...t){for(let n of this.loggers)n.warn(e,...t)}error(e,...t){for(let n of this.loggers)n.error(e,...t)}flush(){for(let e of this.loggers)e.flush()}dispose(){for(let e of this.loggers)e.dispose();super.dispose()}},eu=class extends C{constructor(e,t,n){super();this.logLevel=e;this.logsHome=t;this._loggers=new gt;this._onDidChangeLoggers=this._register(new x);this.onDidChangeLoggers=this._onDidChangeLoggers.event;this._onDidChangeLogLevel=this._register(new x);this.onDidChangeLogLevel=this._onDidChangeLogLevel.event;this._onDidChangeVisibility=this._register(new x);this.onDidChangeVisibility=this._onDidChangeVisibility.event;if(n)for(let i of n)this._loggers.set(i.resource,{logger:void 0,info:i})}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 n=this.toResource(e),i=Ae(e)?e:t?.id??rr(n.toString()).toString(16),s=this._loggers.get(n)?.logger,a=t?.logLevel==="always"?1:t?.logLevel;s||(s=this.doCreateLogger(n,a??this.getLogLevel(n)??this.logLevel,{...t,id:i}));let l={logger:s,info:{resource:n,id:i,logLevel:a,name:t?.name,hidden:t?.hidden,group:t?.group,extensionId:t?.extensionId,when:t?.when}};return this.registerLogger(l.info),this._loggers.set(n,l),s}toResource(e){return Ae(e)?fe(this.logsHome,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):e}setLogLevel(e,t){if(b.isUri(e)){let n=e,i=t,s=this._loggers.get(n);s&&i!==s.info.logLevel&&(s.info.logLevel=i===this.logLevel?void 0:i,s.logger?.setLevel(i),this._loggers.set(s.info.resource,s),this._onDidChangeLogLevel.fire([n,i]))}else{this.logLevel=e;for(let[n,i]of this._loggers.entries())this._loggers.get(n)?.info.logLevel===void 0&&i.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(e,t){let n=this.getLoggerEntry(e);n&&t!==!n.info.hidden&&(n.info.hidden=!t,this._loggers.set(n.info.resource,n),this._onDidChangeVisibility.fire([n.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),n=this._loggers.get(t);n&&(n.logger&&n.logger.dispose(),this._loggers.delete(t),this._onDidChangeLoggers.fire({added:[],removed:[n.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()}},fy=class{constructor(){this.onDidChangeLogLevel=new x().event}setLevel(r){}getLevel(){return 3}trace(r,...e){}debug(r,...e){}info(r,...e){}warn(r,...e){}error(r,...e){}critical(r,...e){}dispose(){}flush(){}},jf=class extends fy{};q7=new $f("logLevel",P2(3))});var Uo,il,my=w(()=>{he();Q();K();Dd();We();Uo=class o extends C{constructor(e,t=Object.create(null)){super();this.database=e;this.options=t;this._onDidChangeStorage=this._register(new Ps);this.onDidChangeStorage=this._onDidChangeStorage.event;this.state=0;this.cache=new Map;this.flushDelayer=this._register(new Pr(o.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,n)=>this.acceptExternal(n,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===2)return;let n=!1;At(t)?n=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),n=!0),n&&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 n=this.cache.get(e);return At(n)?t:n}getBoolean(e,t){let n=this.get(e);return At(n)?t:n==="true"}getNumber(e,t){let n=this.get(e);return At(n)?t:parseInt(n,10)}getObject(e,t){let n=this.get(e);return At(n)?t:sx(n)}async set(e,t,n=!1){if(this.state===2)return;if(At(t))return this.delete(e,n);let i=Je(t)||Array.isArray(t)?ox(t):String(t);if(this.cache.get(e)!==i)return this.cache.set(e,i),this.pendingInserts.set(e,i),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:n}),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}},il=class{constructor(){this.onDidChangeItemsExternal=E.None;this.items=new Map}async getItems(){return this.items}async updateItems(r){r.insert?.forEach((e,t)=>this.items.set(t,e)),r.delete?.forEach(e=>this.items.delete(e))}async optimize(){}async close(){}}});var hy,gy,Jf,vy,Yi,ol,zr,Ns=w(()=>{zt();Ca();Kn();dr();hy=class{constructor(){this._value="";this._pos=0}reset(r){return this._value=r,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(r){let e=r.charCodeAt(0),t=this._value.charCodeAt(this._pos);return e-t}value(){return this._value[this._pos]}},gy=class{constructor(r=!0){this._caseSensitive=r}reset(r){return this._value=r,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let r=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(r)this._from++;else break;else r=!1;return this}cmp(r){return this._caseSensitive?Qp(r,this._value,0,r.length,this._from,this._to):Es(r,this._value,0,r.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},Jf=class{constructor(r=!0,e=!0){this._splitOnBackslash=r;this._caseSensitive=e}reset(r){this._from=0,this._to=0,this._value=r,this._valueLen=r.length;for(let e=r.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 r=!0;for(;this._to<this._valueLen;this._to++){let e=this._value.charCodeAt(this._to);if(e===47||this._splitOnBackslash&&e===92)if(r)this._from++;else break;else r=!1}return this}cmp(r){return this._caseSensitive?Qp(r,this._value,0,r.length,this._from,this._to):Es(r,this._value,0,r.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},vy=class{constructor(r,e){this._ignorePathCasing=r;this._ignoreQueryAndFragment=e;this._states=[];this._stateIdx=0}reset(r){return this._value=r,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new Jf(!1,!this._ignorePathCasing(r)),this._pathIterator.reset(r.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(r)||(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(r){if(this._states[this._stateIdx]===1)return pd(r,this._value.scheme);if(this._states[this._stateIdx]===2)return pd(r,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(r);if(this._states[this._stateIdx]===4)return ud(r,this._value.query);if(this._states[this._stateIdx]===5)return ud(r,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}},Yi=class o{static{this.Val=Symbol("undefined_placeholder")}static wrap(r){return r===void 0?o.Val:r}static unwrap(r){return r===o.Val?void 0:r}},ol=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 r=this.right;return this.right=r.left,r.left=this,this.updateHeight(),r.updateHeight(),r}rotateRight(){let r=this.left;return this.left=r.right,r.right=this,this.updateHeight(),r.updateHeight(),r}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}},zr=class o{static forUris(r=()=>!1,e=()=>!1){return new o(new vy(r,e))}static forPaths(r=!1){return new o(new Jf(void 0,!r))}static forStrings(){return new o(new hy)}static forConfigKeys(){return new o(new gy)}constructor(r){this._iter=r}clear(){this._root=void 0}fill(r,e){if(e){let t=e.slice(0);nv(t);for(let n of t)this.set(n,r)}else{let t=r.slice(0);nv(t);for(let n of t)this.set(n[0],n[1])}}set(r,e){let t=this._iter.reset(r),n;this._root||(this._root=new ol,this._root.segment=t.value());let i=[];for(n=this._root;;){let a=t.cmp(n.segment);if(a>0)n.left||(n.left=new ol,n.left.segment=t.value()),i.push([-1,n]),n=n.left;else if(a<0)n.right||(n.right=new ol,n.right.segment=t.value()),i.push([1,n]),n=n.right;else if(t.hasNext())t.next(),n.mid||(n.mid=new ol,n.mid.segment=t.value()),i.push([0,n]),n=n.mid;else break}let s=Yi.unwrap(n.value);n.value=Yi.wrap(e),n.key=r;for(let a=i.length-1;a>=0;a--){let l=i[a][1];l.updateHeight();let c=l.balanceFactor();if(c<-1||c>1){let d=i[a][0],u=i[a+1][0];if(d===1&&u===1)i[a][1]=l.rotateLeft();else if(d===-1&&u===-1)i[a][1]=l.rotateRight();else if(d===1&&u===-1)l.right=i[a+1][1]=i[a+1][1].rotateRight(),i[a][1]=l.rotateLeft();else if(d===-1&&u===1)l.left=i[a+1][1]=i[a+1][1].rotateLeft(),i[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(i[a-1][0]){case-1:i[a-1][1].left=i[a][1];break;case 1:i[a-1][1].right=i[a][1];break;case 0:i[a-1][1].mid=i[a][1];break}else this._root=i[0][1]}}return s}get(r){return Yi.unwrap(this._getNode(r)?.value)}_getNode(r){let e=this._iter.reset(r),t=this._root;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(),t=t.mid;else break}return t}has(r){let e=this._getNode(r);return!(e?.value===void 0&&e?.mid===void 0)}delete(r){return this._delete(r,!1)}deleteSuperstr(r){return this._delete(r,!0)}_delete(r,e){let t=this._iter.reset(r),n=[],i=this._root;for(;i;){let s=t.cmp(i.segment);if(s>0)n.push([-1,i]),i=i.left;else if(s<0)n.push([1,i]),i=i.right;else if(t.hasNext())t.next(),n.push([0,i]),i=i.mid;else break}if(i){if(e?(i.left=void 0,i.mid=void 0,i.right=void 0,i.height=1):(i.key=void 0,i.value=void 0),!i.mid&&!i.value)if(i.left&&i.right){let s=[[1,i]],a=this._min(i.right,s);if(a.key){i.key=a.key,i.value=a.value,i.segment=a.segment;let l=a.right;if(s.length>1){let[d,u]=s[s.length-1];switch(d){case-1:u.left=l;break;case 0:Ta(!1);case 1:Ta(!1)}}else i.right=l;let c=this._balanceByStack(s);if(n.length>0){let[d,u]=n[n.length-1];switch(d){case-1:u.left=c;break;case 0:u.mid=c;break;case 1:u.right=c;break}}else this._root=c}}else{let s=i.left??i.right;if(n.length>0){let[a,l]=n[n.length-1];switch(a){case-1:l.left=s;break;case 0:l.mid=s;break;case 1:l.right=s;break}}else this._root=s}this._root=this._balanceByStack(n)??this._root}}_min(r,e){for(;r.left;)e.push([-1,r]),r=r.left;return r}_balanceByStack(r){for(let e=r.length-1;e>=0;e--){let t=r[e][1];t.updateHeight();let n=t.balanceFactor();if(n>1?(t.right.balanceFactor()>=0||(t.right=t.right.rotateRight()),r[e][1]=t.rotateLeft()):n<-1&&(t.left.balanceFactor()<=0||(t.left=t.left.rotateLeft()),r[e][1]=t.rotateRight()),e>0)switch(r[e-1][0]){case-1:r[e-1][1].left=r[e][1];break;case 1:r[e-1][1].right=r[e][1];break;case 0:r[e-1][1].mid=r[e][1];break}else return r[0][1]}}findSubstr(r){let e=this._iter.reset(r),t=this._root,n;for(;t;){let i=e.cmp(t.segment);if(i>0)t=t.left;else if(i<0)t=t.right;else if(e.hasNext())e.next(),n=Yi.unwrap(t.value)||n,t=t.mid;else break}return t&&Yi.unwrap(t.value)||n}findSuperstr(r){return this._findSuperstrOrElement(r,!1)}_findSuperstrOrElement(r,e){let t=this._iter.reset(r),n=this._root;for(;n;){let i=t.cmp(n.segment);if(i>0)n=n.left;else if(i<0)n=n.right;else if(t.hasNext())t.next(),n=n.mid;else return n.mid?this._entries(n.mid):e?Yi.unwrap(n.value):void 0}}hasElementOrSubtree(r){return this._findSuperstrOrElement(r,!0)!==void 0}forEach(r){for(let[e,t]of this)r(t,e)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(r){let e=[];return this._dfsEntries(r,e),e[Symbol.iterator]()}_dfsEntries(r,e){r&&(r.left&&this._dfsEntries(r.left,e),r.value!==void 0&&e.push([r.key,Yi.unwrap(r.value)]),r.mid&&this._dfsEntries(r.mid,e),r.right&&this._dfsEntries(r.right,e))}_isBalanced(){let r=e=>{if(!e)return!0;let t=e.balanceFactor();return t<-1||t>1?!1:r(e.left)&&r(e.right)};return r(this._root)}}});function Bs(o){return o.create===!0}function vn(o){return!!(o.capabilities&2)}function Hx(o){return!!(o.capabilities&524288)}function iu(o){return!!(o.capabilities&8)}function Xf(o){return!!(o.capabilities&131072)}function Kx(o){return!!(o.capabilities&262144)}function eo(o){return!!(o.capabilities&4)}function Yf(o){return!!(o.capabilities&16)}function Zf(o){return vn(o)?!!(o.capabilities&16384):!1}function yy(o){return vn(o)?!!(o.capabilities&32768):!1}function $x(o){return!!(o.capabilities&65536)}function Gr(o,r){return sl.create(o,r)}function to(o){return o||Gr(h(2069,null),"Unknown")}function T2(o,r){return o.name=r?`${r} (FileSystemError)`:"FileSystemError",o}function ou(o){if(!o)return"Unknown";if(o instanceof sl)return o.code;let r=/^(.+) \(FileSystemError\)$/.exec(o.name);if(!r)return"Unknown";switch(r[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 jr(o){if(o instanceof Jt)return o.fileOperationResult;switch(ou(o)){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}}function qx(o,r,e){return!o||!r||o===r||r.length>o.length?!1:(r.charAt(r.length-1)!==Bt&&(r+=Bt),e?Eo(o,r):o.indexOf(r)===0)}function wy(o){if(!(typeof o.size!="number"||typeof o.mtime!="number"))return o.mtime.toString(29)+o.size.toString(31)}var ke,sl,Zi,Qf,Jt,al,ll,em,tm,Ii,je=w(()=>{Ns();Se();dr();We();se();Ce();Z();Y();ze();xo();ke=W("fileService");sl=class o extends Error{constructor(e,t){super(e);this.code=t}static create(e,t){let n=new o(e.toString(),t);return T2(n,t),n}};Zi=class{constructor(r,e,t){this.resource=r;this.operation=e;this.target=t}isOperation(r){return this.operation===r}},Qf=class o{constructor(r,e){this.ignorePathCasing=e;this.correlationId=void 0;this.added=new xr(()=>{let r=zr.forUris(()=>this.ignorePathCasing);return r.fill(this.rawAdded.map(e=>[e,!0])),r});this.updated=new xr(()=>{let r=zr.forUris(()=>this.ignorePathCasing);return r.fill(this.rawUpdated.map(e=>[e,!0])),r});this.deleted=new xr(()=>{let r=zr.forUris(()=>this.ignorePathCasing);return r.fill(this.rawDeleted.map(e=>[e,!0])),r});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let t of r){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!==o.MIXED_CORRELATION&&(typeof t.cId=="number"?this.correlationId===void 0?this.correlationId=t.cId:this.correlationId!==t.cId&&(this.correlationId=o.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=o.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(r,...e){return this.doContains(r,{includeChildren:!1},...e)}affects(r,...e){return this.doContains(r,{includeChildren:!0},...e)}doContains(r,e,...t){if(!r)return!1;let n=t.length>0;return!!((!n||t.includes(1))&&(this.added.value.get(r)||e.includeChildren&&this.added.value.findSuperstr(r))||(!n||t.includes(0))&&(this.updated.value.get(r)||e.includeChildren&&this.updated.value.findSuperstr(r))||(!n||t.includes(2))&&(this.deleted.value.findSubstr(r)||e.includeChildren&&this.deleted.value.findSuperstr(r)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(r){return this.correlationId===r}hasCorrelation(){return typeof this.correlationId=="number"}};Jt=class extends Error{constructor(e,t,n){super(e);this.fileOperationResult=t;this.options=n}},al=class extends Jt{constructor(e,t,n,i){super(e,t,i);this.fileOperationResult=t;this.size=n}},ll=class extends Jt{constructor(e,t,n){super(e,2,n);this.stat=t}},em={OFF:"off",ON_EXIT:"onExit",ON_EXIT_AND_WINDOW_CLOSE:"onExitAndWindowClose"},tm="";Ii=class o{static{this.KB=1024}static{this.MB=o.KB*o.KB}static{this.GB=o.MB*o.KB}static{this.TB=o.GB*o.KB}static formatSize(r){return Hn(r)||(r=0),r<o.KB?h(2064,null,r.toFixed(0)):r<o.MB?h(2066,null,(r/o.KB).toFixed(2)):r<o.GB?h(2067,null,(r/o.MB).toFixed(2)):r<o.TB?h(2065,null,(r/o.GB).toFixed(2)):h(2068,null,(r/o.TB).toFixed(2))}}});function Rt(o){let r=o;return typeof r?.id=="string"&&b.isUri(r.uri)}function No(o,r){if(typeof o=="string"||typeof o>"u")return typeof o=="string"?{id:ye(o)}:r?C2:_2;let e=o;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 it(o){let r=o;return typeof r?.id=="string"&&b.isUri(r.configPath)}function zx(o){let r=o;if(r?.uri)return{id:r.id,uri:b.revive(r.uri)};let e=o;if(e?.configPath)return{id:e.id,configPath:b.revive(e.configPath)};if(o?.id)return{id:o.id}}function by(o,r){return Ge.isEqualOrParent(o,r.untitledWorkspacesHome)}function bi(o){return(typeof o=="string"?ba(o):o1(o))===k2}var P9,C2,_2,rm,su,k2,Gx,Iy,hr=w(()=>{Ce();Se();Ns();yt();se();Z();ze();P9=W("contextService");C2={id:"ext-dev"},_2={id:"empty-window"};rm=class{constructor(r,e){this.raw=e;this.uri=r.uri,this.index=r.index,this.name=r.name}toResource(r){return fe(this.uri,r)}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}},su="code-workspace",k2=`.${su}`,Gx=[{name:h(2755,null),extensions:[su]}],Iy="workspace.json"});var Dt,Xn=w(()=>{Z();Dt=W("IUriIdentityService")});function jx(o){let r=o;return!!(r&&typeof r=="object"&&typeof r.id=="string"&&typeof r.isDefault=="boolean"&&typeof r.name=="string"&&b.isUri(r.location)&&b.isUri(r.globalStorageHome)&&b.isUri(r.settingsResource)&&b.isUri(r.keybindingsResource)&&b.isUri(r.tasksResource)&&b.isUri(r.snippetsHome)&&b.isUri(r.promptsHome)&&b.isUri(r.extensionsResource)&&b.isUri(r.mcpResource))}function nm(o,r,e,t,n,i){return{id:o,name:r,location:e,isDefault:!1,icon:n?.icon,globalStorageHome:i&&n?.useDefaultFlags?.globalState?i.globalStorageHome:fe(e,"globalStorage"),settingsResource:i&&n?.useDefaultFlags?.settings?i.settingsResource:fe(e,"settings.json"),keybindingsResource:i&&n?.useDefaultFlags?.keybindings?i.keybindingsResource:fe(e,"keybindings.json"),tasksResource:i&&n?.useDefaultFlags?.tasks?i.tasksResource:fe(e,"tasks.json"),snippetsHome:i&&n?.useDefaultFlags?.snippets?i.snippetsHome:fe(e,"snippets"),promptsHome:i&&n?.useDefaultFlags?.prompts?i.promptsHome:fe(e,"prompts"),extensionsResource:i&&n?.useDefaultFlags?.extensions?i.extensionsResource:fe(e,"extensions.json"),mcpResource:i&&n?.useDefaultFlags?.mcp?i.mcpResource:fe(e,"mcp.json"),cacheHome:fe(t,o),useDefaultFlags:n?.useDefaultFlags,isTransient:n?.transient,workspaces:n?.workspaces}}var _r,cl,Yn=w(()=>{yi();Q();K();yt();se();Ce();qr();je();Z();re();hr();Xn();he();Mt();dr();We();_r=W("IUserDataProfilesService");cl=class extends C{constructor(e,t,n,i){super();this.environmentService=e;this.fileService=t;this.uriIdentityService=n;this.logService=i;this._onDidChangeProfiles=this._register(new x);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._onWillCreateProfile=this._register(new x);this.onWillCreateProfile=this._onWillCreateProfile.event;this._onWillRemoveProfile=this._register(new x);this.onWillRemoveProfile=this._onWillRemoveProfile.event;this._onDidResetWorkspaces=this._register(new x);this.onDidResetWorkspaces=this._onDidResetWorkspaces.event;this.profileCreationPromises=new Map;this.transientProfilesObject={profiles:[],emptyWindows:new Map};this.profilesHome=fe(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=fe(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 i of this.getStoredProfiles()){if(this.isInvalidProfile(i)){this.logService.warn("Skipping the invalid stored profile",i.location||i.name);continue}let s=Kr(i.location);t.push(nm(s,i.name,i.location,this.profilesCacheHome,{icon:i.icon,useDefaultFlags:i.useDefaultFlags},e))}}catch(i){this.logService.error(i)}let n=new Map;if(t.length)try{let i=this.getStoredProfileAssociations();if(i.workspaces)for(let[s,a]of Object.entries(i.workspaces)){let l=b.parse(s),c=t.find(d=>d.id===a);if(c){let d=c.workspaces?c.workspaces.slice(0):[];d.push(l),c.workspaces=d}}if(i.emptyWindows)for(let[s,a]of Object.entries(i.emptyWindows)){let l=t.find(c=>c.id===a);l&&n.set(s,l)}}catch(i){this.logService.error(i)}this._profilesObject={profiles:t,emptyWindows:n}}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=nm("__default__profile__",h(2708,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){let t="Temp",n=new RegExp(`${Po(t)}\\s(\\d+)`),i=0;for(let a of this.profiles){let l=n.exec(a.name),c=l?parseInt(l[1]):0;i=c>i?c:i}let s=`${t} ${i+1}`;return this.createProfile(rr(xe()).toString(16),s,{transient:!0},e)}async createNamedProfile(e,t,n){return this.createProfile(rr(xe()).toString(16),e,t,n)}async createProfile(e,t,n,i){return await this.doCreateProfile(e,t,n,i)}async doCreateProfile(e,t,n,i){if(!Ae(t)||!t)throw new Error("Name of the profile is mandatory and must be of type `string`");let s=this.profileCreationPromises.get(t);return s||(s=(async()=>{try{if(this.profiles.find(u=>u.id===e||!u.isTransient&&!n?.transient&&u.name===t))throw new Error(`Profile with ${t} name already exists`);let l=i?this.getWorkspace(i):void 0;b.isUri(l)&&(n={...n,workspaces:[l]});let c=nm(e,t,this.uriIdentityService.extUri.joinPath(this.profilesHome,e),this.profilesCacheHome,n,this.defaultProfile);await this.fileService.createFolder(c.location);let d=[];return this._onWillCreateProfile.fire({profile:c,join(u){d.push(u)}}),await wt.settled(d),l&&!b.isUri(l)&&this.updateEmptyWindowAssociation(l,c,!!c.isTransient),this.updateProfiles([c],[],[]),c}finally{this.profileCreationPromises.delete(t)}})(),this.profileCreationPromises.set(t,s)),s}async updateProfile(e,t){let n=[];for(let s of this.profiles){let a;if(e.id===s.id)s.isDefault?t.workspaces&&(a=s,a.workspaces=t.workspaces):a=nm(s.id,t.name??s.name,s.location,this.profilesCacheHome,{icon:t.icon===null?void 0:t.icon??s.icon,transient:t.transient??s.isTransient,useDefaultFlags:t.useDefaultFlags??s.useDefaultFlags,workspaces:t.workspaces??s.workspaces},this.defaultProfile);else if(t.workspaces){let l=s.workspaces?.filter(c=>!t.workspaces?.some(d=>this.uriIdentityService.extUri.isEqual(c,d)));s.workspaces?.length!==l?.length&&(a=s,a.workspaces=l)}a&&n.push(a)}if(!n.length)throw e.isDefault?new Error("Cannot update default profile"):new Error(`Profile '${e.name}' does not exist`);this.updateProfiles([],[],n);let i=this.profiles.find(s=>s.id===e.id);if(!i)throw new Error(`Profile '${e.name}' was not updated`);return i}async removeProfile(e){if(e.isDefault)throw new Error("Cannot remove default profile");let t=this.profiles.find(i=>i.id===e.id);if(!t)throw new Error(`Profile '${e.name}' does not exist`);let n=[];this._onWillRemoveProfile.fire({profile:t,join(i){n.push(i)}});try{await Promise.allSettled(n)}catch(i){this.logService.error(i)}this.updateProfiles([],[t],[]);try{await this.fileService.del(t.cacheHome,{recursive:!0})}catch(i){jr(i)!==1&&this.logService.error(i)}}async setProfileForWorkspace(e,t){let n=this.profiles.find(s=>s.id===t.id);if(!n)throw new Error(`Profile '${t.name}' does not exist`);let i=this.getWorkspace(e);if(b.isUri(i)){let s=n.workspaces?[...n.workspaces]:[];s.some(a=>this.uriIdentityService.extUri.isEqual(a,i))||(s.push(i),await this.updateProfile(n,{workspaces:s}))}else this.updateEmptyWindowAssociation(i,n,!1),this.updateStoredProfiles(this.profiles)}unsetWorkspace(e,t=!1){let n=this.getWorkspace(e);if(b.isUri(n)){let i=this.getProfileForWorkspace(e);i&&this.updateProfile(i,{workspaces:i.workspaces?.filter(s=>!this.uriIdentityService.extUri.isEqual(s,n))})}else this.updateEmptyWindowAssociation(n,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(n){this.logService.error(n)}let t=await this.fileService.resolve(this.profilesHome);await Promise.all((t.children||[]).filter(n=>n.isDirectory&&this.profiles.every(i=>!this.uriIdentityService.extUri.isEqual(i.location,n.resource))).map(n=>this.fileService.del(n.resource,{recursive:!0})))}}catch(e){this.logService.error("Error deleting redundant profile folders",e)}try{let e=this.getStoredProfiles(),t=[];for(let n of this.getStoredProfiles())this.isInvalidProfile(n)?this.logService.warn(`Invalid user data profile found: ${n.name}`):t.push(n);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 b.isUri(t)?this.profiles.find(n=>n.workspaces?.some(i=>this.uriIdentityService.extUri.isEqual(i,t))):this.profilesObject.emptyWindows.get(t)??this.transientProfilesObject.emptyWindows.get(t)}getWorkspace(e){return Rt(e)?e.uri:it(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,n,i=!1){let s=[...this.profiles,...e],a=this.transientProfilesObject.profiles;this.transientProfilesObject.profiles=[];let l=[];for(let c of s){if(t.some(d=>c.id===d.id)){for(let d of[...this.profilesObject.emptyWindows.keys()])c.id===this.profilesObject.emptyWindows.get(d)?.id&&this.profilesObject.emptyWindows.delete(d);continue}if(!c.isDefault){c=n.find(u=>c.id===u.id)??c;let d=a.find(u=>c.id===u.id);if(c.isTransient)this.transientProfilesObject.profiles.push(c);else if(d){for(let[u,f]of this.transientProfilesObject.emptyWindows.entries())if(c.id===f.id){this.transientProfilesObject.emptyWindows.delete(u),this.profilesObject.emptyWindows.set(u,c);break}}}c.workspaces?.length===0&&(c.workspaces=void 0),l.push(c)}this.updateStoredProfiles(l),i||this.triggerProfilesChanges(e,t,n)}triggerProfilesChanges(e,t,n){this._onDidChangeProfiles.fire({added:e,removed:t,updated:n,all:this.profiles})}updateEmptyWindowAssociation(e,t,n){n=t?.isTransient?!0:n,n?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=[],n={},i={};for(let s of e)if(!s.isTransient&&(s.isDefault||t.push({location:s.location,name:s.name,icon:s.icon,useDefaultFlags:s.useDefaultFlags}),s.workspaces))for(let a of s.workspaces)n[a.toString()]=s.id;for(let[s,a]of this.profilesObject.emptyWindows.entries())i[s.toString()]=a.id;this.saveStoredProfileAssociations({workspaces:n,emptyWindows:i}),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(){}};cl=T([g(0,$r),g(1,ke),g(2,Dt),g(3,O)],cl)});function sm(o){let r=o.get(ro);if(r)try{return JSON.parse(r)}catch{}return Object.create(null)}function om(o){return o.isDefault||!!o.useDefaultFlags?.globalState}async function D2(o,r,e,t,n,i){let s=v=>{try{return JSON.parse(v)}catch{return v}},a=new Map,l=new Map;o.forEach((v,S)=>{a.set(S,v),l.set(S,s(v))});let c=new Map,d=new Map;r.forEach((v,S)=>{c.set(S,v),d.set(S,s(v))});let u=new Map,f=new Map;e.forEach((v,S)=>{u.set(S,v),f.set(S,s(v))}),console.group(t!==n?`Storage: Application (path: ${t})`:`Storage: Application & Profile (path: ${t}, default profile)`);let m=[];if(a.forEach((v,S)=>{m.push({key:S,value:v})}),console.table(m),console.groupEnd(),console.log(l),t!==n){console.group(`Storage: Profile (path: ${n}, profile specific)`);let v=[];c.forEach((S,I)=>{v.push({key:I,value:S})}),console.table(v),console.groupEnd(),console.log(d)}console.group(`Storage: Workspace (path: ${i})`);let y=[];u.forEach((v,S)=>{y.push({key:S,value:v})}),console.table(y),console.groupEnd(),console.log(f)}var au,ro,c8,im,Hs=w(()=>{he();Q();K();ai();We();my();Z();Yn();au="__$__isNewStorageMarker",ro="__$__targetStorageMarker",c8=W("storageService");im=class o extends C{constructor(e={flushInterval:o.DEFAULT_FLUSH_INTERVAL}){super();this._onDidChangeValue=this._register(new Ps);this._onDidChangeTarget=this._register(new Ps);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onWillSaveState=this._register(new x);this.onWillSaveState=this._onWillSaveState.event;this.runFlushWhenIdle=this._register(new er);this._workspaceKeyTargets=void 0;this._profileKeyTargets=void 0;this._applicationKeyTargets=void 0;this.flushWhenIdleScheduler=this._register(new pr(()=>this.doFlushWhenIdle(),e.flushInterval))}static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}onDidChangeValue(e,t,n){return E.filter(this._onDidChangeValue.event,i=>i.scope===e&&(t===void 0||i.key===t),n)}doFlushWhenIdle(){this.runFlushWhenIdle.value=yd(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){pt([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{Ne("code/willInitStorage");try{await this.doInitialize()}finally{Ne("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,t){let{key:n,external:i}=t;if(n===ro){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:n,target:this.getKeyTargets(e)[n],external:i})}emitWillSaveState(e){this._onWillSaveState.fire({reason:e})}get(e,t,n){return this.getStorage(t)?.get(e,n)}getBoolean(e,t,n){return this.getStorage(t)?.getBoolean(e,n)}getNumber(e,t,n){return this.getStorage(t)?.getNumber(e,n)}getObject(e,t,n){return this.getStorage(t)?.getObject(e,n)}storeAll(e,t){this.withPausedEmitters(()=>{for(let n of e)this.store(n.key,n.value,n.scope,n.target,t)})}store(e,t,n,i,s=!1){if(At(t)){this.remove(e,n,s);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,n,i),this.getStorage(n)?.set(e,t,s)})}remove(e,t,n=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,n)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}keys(e,t){let n=[],i=this.getKeyTargets(e);for(let s of Object.keys(i))i[s]===t&&n.push(s);return n}updateKeyTarget(e,t,n,i=!1){let s=this.getKeyTargets(t);typeof n=="number"?s[e]!==n&&(s[e]=n,this.getStorage(t)?.set(ro,JSON.stringify(s),i)):typeof s[e]=="number"&&(delete s[e],this.getStorage(t)?.set(ro,JSON.stringify(s),i))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){let t=this.getStorage(e);return t?sm(t):Object.create(null)}isNew(e){return this.getBoolean(au,e)===!0}async flush(e=0){this._onWillSaveState.fire({reason:e});let t=this.getStorage(-1),n=this.getStorage(0),i=this.getStorage(1);switch(e){case 0:await wt.settled([t?.whenFlushed()??Promise.resolve(),n?.whenFlushed()??Promise.resolve(),i?.whenFlushed()??Promise.resolve()]);break;case 1:await wt.settled([t?.flush(0)??Promise.resolve(),n?.flush(0)??Promise.resolve(),i?.flush(0)??Promise.resolve()]);break}}async log(){let e=this.getStorage(-1)?.items??new Map,t=this.getStorage(0)?.items??new Map,n=this.getStorage(1)?.items??new Map;return D2(e,t,n,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),jx(e)?this.switchToProfile(e,t):this.switchToWorkspace(e,t)}canSwitchProfile(e,t){return!(e.id===t.id||om(t)&&om(e))}switchData(e,t,n){this.withPausedEmitters(()=>{let i=new Set;for(let[s,a]of e)i.add(s),t.get(s)!==a&&this.emitDidChangeValue(n,{key:s,external:!0});for(let[s]of t.items)i.has(s)||this.emitDidChangeValue(n,{key:s,external:!0})})}}});var am,ft,Jr=w(()=>{Z();am=W("stateReadService"),ft=W("stateService")});function Ks(o){return!!o.workspaceUri}function dl(o){return!!o.folderUri}function xy(o){return!!o.fileUri}function W2(o,r){if(Dr)return!1;let e=Bo(o,r),t=o.getValue("window");return t?.menuStyle==="native"?!(!V&&!e):t?.menuStyle==="custom"?!1:e}function Py(o,r){return Dr?!1:V?!0:W2(o,r)}function Jx(o){let r=o.getValue("window.menuBarVisibility");return r==="default"||r==="compact"&&Py(o)||V&&Wp?"classic":r}function Bo(o,r){return r||(r=Qx(o)),r==="native"}function Qx(o){if(Dr)return"custom";let r=o.getValue("window");if(r){if(V&&r.nativeTabs===!0||V&&r.nativeFullScreen===!1)return"native";let n=r.titleBarStyle;if(n==="native"||n==="custom")return n}return"custom"}function L2(o){if(Dr||V||Qx(o)==="native")return"native";let e=o.getValue("window")?.controlsStyle;return e==="custom"||e==="hidden"?e:"native"}function lu(o){if(Dr||Bo(o))return!1;if(!V){let r=L2(o);if(r==="custom"||r==="hidden")return!1}return!0}function lm(o){let r=o.getValue("window");return!r||typeof r.nativeFullScreen!="boolean"||r.nativeTabs?!0:r.nativeFullScreen!==!1}function Yx(o=0){return 1.2**o}var Sy,Xx,Zx,eP,Ey,no=w(()=>{Y();Sy={WIDTH:400,WIDTH_WITH_VERTICAL_PANEL:600,HEIGHT:270};Xx=35;Zx={width:1200,height:800},eP={width:1440,height:900},Ey={width:1024,height:768}});import A2 from"electron";var Si,tP,xi=w(()=>{no();Si=function(o=1,r=!1){let e=r?eP:Zx;return{width:e.width,height:e.height,mode:o}},tP=function(){let o=Ey.width,r=Ey.height,e=A2.screen.getPrimaryDisplay().workArea,t=Math.max(e.x+e.width/2-o/2,0),n=Math.max(e.y+e.height/2-r/2,0);return{x:t,y:n,width:o,height:r,mode:1}}});function Ho(o,r){let e=Math.pow(10,r);return Math.round(o*e)/e}var _,Vo,ul,Ko,Ty=w(()=>{Kn();_=class{constructor(r,e,t,n=1){this._rgbaBrand=void 0;this.r=Math.min(255,Math.max(0,r))|0,this.g=Math.min(255,Math.max(0,e))|0,this.b=Math.min(255,Math.max(0,t))|0,this.a=Ho(Math.max(Math.min(1,n),0),3)}static equals(r,e){return r.r===e.r&&r.g===e.g&&r.b===e.b&&r.a===e.a}},Vo=class o{constructor(r,e,t,n){this._hslaBrand=void 0;this.h=Math.max(Math.min(360,r),0)|0,this.s=Ho(Math.max(Math.min(1,e),0),3),this.l=Ho(Math.max(Math.min(1,t),0),3),this.a=Ho(Math.max(Math.min(1,n),0),3)}static equals(r,e){return r.h===e.h&&r.s===e.s&&r.l===e.l&&r.a===e.a}static fromRGBA(r){let e=r.r/255,t=r.g/255,n=r.b/255,i=r.a,s=Math.max(e,t,n),a=Math.min(e,t,n),l=0,c=0,d=(a+s)/2,u=s-a;if(u>0){switch(c=Math.min(d<=.5?u/(2*d):u/(2-2*d),1),s){case e:l=(t-n)/u+(t<n?6:0);break;case t:l=(n-e)/u+2;break;case n:l=(e-t)/u+4;break}l*=60,l=Math.round(l)}return new o(l,c,d,i)}static _hue2rgb(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*(2/3-t)*6:r}static toRGBA(r){let e=r.h/360,{s:t,l:n,a:i}=r,s,a,l;if(t===0)s=a=l=n;else{let c=n<.5?n*(1+t):n+t-n*t,d=2*n-c;s=o._hue2rgb(d,c,e+1/3),a=o._hue2rgb(d,c,e),l=o._hue2rgb(d,c,e-1/3)}return new _(Math.round(s*255),Math.round(a*255),Math.round(l*255),i)}},ul=class o{constructor(r,e,t,n){this._hsvaBrand=void 0;this.h=Math.max(Math.min(360,r),0)|0,this.s=Ho(Math.max(Math.min(1,e),0),3),this.v=Ho(Math.max(Math.min(1,t),0),3),this.a=Ho(Math.max(Math.min(1,n),0),3)}static equals(r,e){return r.h===e.h&&r.s===e.s&&r.v===e.v&&r.a===e.a}static fromRGBA(r){let e=r.r/255,t=r.g/255,n=r.b/255,i=Math.max(e,t,n),s=Math.min(e,t,n),a=i-s,l=i===0?0:a/i,c;return a===0?c=0:i===e?c=((t-n)/a%6+6)%6:i===t?c=(n-e)/a+2:c=(e-t)/a+4,new o(Math.round(c*60),l,i,r.a)}static toRGBA(r){let{h:e,s:t,v:n,a:i}=r,s=n*t,a=s*(1-Math.abs(e/60%2-1)),l=n-s,[c,d,u]=[0,0,0];return e<60?(c=s,d=a):e<120?(c=a,d=s):e<180?(d=s,u=a):e<240?(d=a,u=s):e<300?(c=a,u=s):e<=360&&(c=s,u=a),c=Math.round((c+l)*255),d=Math.round((d+l)*255),u=Math.round((u+l)*255),new _(c,d,u,i)}},Ko=class o{static fromHex(r){return o.Format.CSS.parseHex(r)||o.red}static equals(r,e){return!r&&!e?!0:!r||!e?!1:r.equals(e)}get hsla(){return this._hsla?this._hsla:Vo.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:ul.fromRGBA(this.rgba)}constructor(r){if(r)if(r instanceof _)this.rgba=r;else if(r instanceof Vo)this._hsla=r,this.rgba=Vo.toRGBA(r);else if(r instanceof ul)this._hsva=r,this.rgba=ul.toRGBA(r);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(r){return!!r&&_.equals(this.rgba,r.rgba)&&Vo.equals(this.hsla,r.hsla)&&ul.equals(this.hsva,r.hsva)}getRelativeLuminance(){let r=o._relativeLuminanceForComponent(this.rgba.r),e=o._relativeLuminanceForComponent(this.rgba.g),t=o._relativeLuminanceForComponent(this.rgba.b),n=.2126*r+.7152*e+.0722*t;return Ho(n,4)}reduceRelativeLuminace(r,e){let{r:t,g:n,b:i}=r.rgba,s=this.getContrastRatio(r);for(;s<e&&(t>0||n>0||i>0);)t-=Math.max(0,Math.ceil(t*.1)),n-=Math.max(0,Math.ceil(n*.1)),i-=Math.max(0,Math.ceil(i*.1)),s=this.getContrastRatio(new o(new _(t,n,i)));return new o(new _(t,n,i))}increaseRelativeLuminace(r,e){let{r:t,g:n,b:i}=r.rgba,s=this.getContrastRatio(r);for(;s<e&&(t<255||n<255||i<255);)t=Math.min(255,t+Math.ceil((255-t)*.1)),n=Math.min(255,n+Math.ceil((255-n)*.1)),i=Math.min(255,i+Math.ceil((255-i)*.1)),s=this.getContrastRatio(new o(new _(t,n,i)));return new o(new _(t,n,i))}static _relativeLuminanceForComponent(r){let e=r/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}getContrastRatio(r){let e=this.getRelativeLuminance(),t=r.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(r){let e=this.getRelativeLuminance(),t=r.getRelativeLuminance();return e>t}isDarkerThan(r){let e=this.getRelativeLuminance(),t=r.getRelativeLuminance();return e<t}ensureConstrast(r,e){let t=this.getRelativeLuminance(),n=r.getRelativeLuminance();if(this.getContrastRatio(r)<e){if(n<t){let l=this.reduceRelativeLuminace(r,e),c=this.getContrastRatio(l);if(c<e){let d=this.increaseRelativeLuminace(r,e),u=this.getContrastRatio(d);return c>u?l:d}return l}let s=this.increaseRelativeLuminace(r,e),a=this.getContrastRatio(s);if(a<e){let l=this.reduceRelativeLuminace(r,e),c=this.getContrastRatio(l);return a>c?s:l}return s}return r}lighten(r){return new o(new Vo(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*r,this.hsla.a))}darken(r){return new o(new Vo(this.hsla.h,this.hsla.s,this.hsla.l-this.hsla.l*r,this.hsla.a))}transparent(r){let{r:e,g:t,b:n,a:i}=this.rgba;return new o(new _(e,t,n,i*r))}isTransparent(){return this.rgba.a===0}isOpaque(){return this.rgba.a===1}opposite(){return new o(new _(255-this.rgba.r,255-this.rgba.g,255-this.rgba.b,this.rgba.a))}blend(r){let e=r.rgba,t=this.rgba.a,n=e.a,i=t+n*(1-t);if(i<1e-6)return o.transparent;let s=this.rgba.r*t/i+e.r*n*(1-t)/i,a=this.rgba.g*t/i+e.g*n*(1-t)/i,l=this.rgba.b*t/i+e.b*n*(1-t)/i;return new o(new _(s,a,l,i))}mix(r,e=.5){let t=Math.min(Math.max(e,0),1),n=this.rgba,i=r.rgba,s=n.r+(i.r-n.r)*t,a=n.g+(i.g-n.g)*t,l=n.b+(i.b-n.b)*t,c=n.a+(i.a-n.a)*t;return new o(new _(s,a,l,c))}makeOpaque(r){if(this.isOpaque()||r.rgba.a!==1)return this;let{r:e,g:t,b:n,a:i}=this.rgba;return new o(new _(r.rgba.r-i*(r.rgba.r-e),r.rgba.g-i*(r.rgba.g-t),r.rgba.b-i*(r.rgba.b-n),1))}flatten(...r){let e=r.reduceRight((t,n)=>o._flatten(n,t));return o._flatten(this,e)}static _flatten(r,e){let t=1-r.rgba.a;return new o(new _(t*e.rgba.r+r.rgba.a*r.rgba.r,t*e.rgba.g+r.rgba.a*r.rgba.g,t*e.rgba.b+r.rgba.a*r.rgba.b))}toString(){return this._toString||(this._toString=o.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(r,e,t){if(r.isLighterThan(e))return r;t=t||.5;let n=r.getRelativeLuminance(),i=e.getRelativeLuminance();return t=t*(i-n)/i,r.lighten(t)}static getDarkerColor(r,e,t){if(r.isDarkerThan(e))return r;t=t||.5;let n=r.getRelativeLuminance(),i=e.getRelativeLuminance();return t=t*(n-i)/n,r.darken(t)}static{this.white=new o(new _(255,255,255,1))}static{this.black=new o(new _(0,0,0,1))}static{this.red=new o(new _(255,0,0,1))}static{this.blue=new o(new _(0,0,255,1))}static{this.green=new o(new _(0,255,0,1))}static{this.cyan=new o(new _(0,255,255,1))}static{this.lightgrey=new o(new _(211,211,211,1))}static{this.transparent=new o(new _(0,0,0,0))}};(r=>{let o;(t=>{let e;(S=>{function n(I){return I.rgba.a===1?`rgb(${I.rgba.r}, ${I.rgba.g}, ${I.rgba.b})`:r.Format.CSS.formatRGBA(I)}S.formatRGB=n;function i(I){return`rgba(${I.rgba.r}, ${I.rgba.g}, ${I.rgba.b}, ${+I.rgba.a.toFixed(2)})`}S.formatRGBA=i;function s(I){return I.hsla.a===1?`hsl(${I.hsla.h}, ${Math.round(I.hsla.s*100)}%, ${Math.round(I.hsla.l*100)}%)`:r.Format.CSS.formatHSLA(I)}S.formatHSL=s;function a(I){return`hsla(${I.hsla.h}, ${Math.round(I.hsla.s*100)}%, ${Math.round(I.hsla.l*100)}%, ${I.hsla.a.toFixed(2)})`}S.formatHSLA=a;function l(I){let k=I.toString(16);return k.length!==2?"0"+k:k}function c(I){return`#${l(I.rgba.r)}${l(I.rgba.g)}${l(I.rgba.b)}`}S.formatHex=c;function d(I,k=!1){return k&&I.rgba.a===1?r.Format.CSS.formatHex(I):`#${l(I.rgba.r)}${l(I.rgba.g)}${l(I.rgba.b)}${l(Math.round(I.rgba.a*255))}`}S.formatHexA=d;function u(I){return I.isOpaque()?r.Format.CSS.formatHex(I):r.Format.CSS.formatRGBA(I)}S.format=u;function f(I){if(I==="transparent")return r.transparent;if(I.startsWith("#"))return y(I);if(I.startsWith("rgba(")){let k=I.match(/rgba\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+), *(?<a>(?:\+|-)?\d+(\.\d+)?)\)/);if(!k)throw new Error("Invalid color format "+I);let R=parseInt(k.groups?.r??"0"),D=parseInt(k.groups?.g??"0"),F=parseInt(k.groups?.b??"0"),ce=parseFloat(k.groups?.a??"0");return new r(new _(R,D,F,ce))}if(I.startsWith("rgb(")){let k=I.match(/rgb\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+)\)/);if(!k)throw new Error("Invalid color format "+I);let R=parseInt(k.groups?.r??"0"),D=parseInt(k.groups?.g??"0"),F=parseInt(k.groups?.b??"0");return new r(new _(R,D,F))}return m(I)}S.parse=f;function m(I){switch(I){case"aliceblue":return new r(new _(240,248,255,1));case"antiquewhite":return new r(new _(250,235,215,1));case"aqua":return new r(new _(0,255,255,1));case"aquamarine":return new r(new _(127,255,212,1));case"azure":return new r(new _(240,255,255,1));case"beige":return new r(new _(245,245,220,1));case"bisque":return new r(new _(255,228,196,1));case"black":return new r(new _(0,0,0,1));case"blanchedalmond":return new r(new _(255,235,205,1));case"blue":return new r(new _(0,0,255,1));case"blueviolet":return new r(new _(138,43,226,1));case"brown":return new r(new _(165,42,42,1));case"burlywood":return new r(new _(222,184,135,1));case"cadetblue":return new r(new _(95,158,160,1));case"chartreuse":return new r(new _(127,255,0,1));case"chocolate":return new r(new _(210,105,30,1));case"coral":return new r(new _(255,127,80,1));case"cornflowerblue":return new r(new _(100,149,237,1));case"cornsilk":return new r(new _(255,248,220,1));case"crimson":return new r(new _(220,20,60,1));case"cyan":return new r(new _(0,255,255,1));case"darkblue":return new r(new _(0,0,139,1));case"darkcyan":return new r(new _(0,139,139,1));case"darkgoldenrod":return new r(new _(184,134,11,1));case"darkgray":return new r(new _(169,169,169,1));case"darkgreen":return new r(new _(0,100,0,1));case"darkgrey":return new r(new _(169,169,169,1));case"darkkhaki":return new r(new _(189,183,107,1));case"darkmagenta":return new r(new _(139,0,139,1));case"darkolivegreen":return new r(new _(85,107,47,1));case"darkorange":return new r(new _(255,140,0,1));case"darkorchid":return new r(new _(153,50,204,1));case"darkred":return new r(new _(139,0,0,1));case"darksalmon":return new r(new _(233,150,122,1));case"darkseagreen":return new r(new _(143,188,143,1));case"darkslateblue":return new r(new _(72,61,139,1));case"darkslategray":return new r(new _(47,79,79,1));case"darkslategrey":return new r(new _(47,79,79,1));case"darkturquoise":return new r(new _(0,206,209,1));case"darkviolet":return new r(new _(148,0,211,1));case"deeppink":return new r(new _(255,20,147,1));case"deepskyblue":return new r(new _(0,191,255,1));case"dimgray":return new r(new _(105,105,105,1));case"dimgrey":return new r(new _(105,105,105,1));case"dodgerblue":return new r(new _(30,144,255,1));case"firebrick":return new r(new _(178,34,34,1));case"floralwhite":return new r(new _(255,250,240,1));case"forestgreen":return new r(new _(34,139,34,1));case"fuchsia":return new r(new _(255,0,255,1));case"gainsboro":return new r(new _(220,220,220,1));case"ghostwhite":return new r(new _(248,248,255,1));case"gold":return new r(new _(255,215,0,1));case"goldenrod":return new r(new _(218,165,32,1));case"gray":return new r(new _(128,128,128,1));case"green":return new r(new _(0,128,0,1));case"greenyellow":return new r(new _(173,255,47,1));case"grey":return new r(new _(128,128,128,1));case"honeydew":return new r(new _(240,255,240,1));case"hotpink":return new r(new _(255,105,180,1));case"indianred":return new r(new _(205,92,92,1));case"indigo":return new r(new _(75,0,130,1));case"ivory":return new r(new _(255,255,240,1));case"khaki":return new r(new _(240,230,140,1));case"lavender":return new r(new _(230,230,250,1));case"lavenderblush":return new r(new _(255,240,245,1));case"lawngreen":return new r(new _(124,252,0,1));case"lemonchiffon":return new r(new _(255,250,205,1));case"lightblue":return new r(new _(173,216,230,1));case"lightcoral":return new r(new _(240,128,128,1));case"lightcyan":return new r(new _(224,255,255,1));case"lightgoldenrodyellow":return new r(new _(250,250,210,1));case"lightgray":return new r(new _(211,211,211,1));case"lightgreen":return new r(new _(144,238,144,1));case"lightgrey":return new r(new _(211,211,211,1));case"lightpink":return new r(new _(255,182,193,1));case"lightsalmon":return new r(new _(255,160,122,1));case"lightseagreen":return new r(new _(32,178,170,1));case"lightskyblue":return new r(new _(135,206,250,1));case"lightslategray":return new r(new _(119,136,153,1));case"lightslategrey":return new r(new _(119,136,153,1));case"lightsteelblue":return new r(new _(176,196,222,1));case"lightyellow":return new r(new _(255,255,224,1));case"lime":return new r(new _(0,255,0,1));case"limegreen":return new r(new _(50,205,50,1));case"linen":return new r(new _(250,240,230,1));case"magenta":return new r(new _(255,0,255,1));case"maroon":return new r(new _(128,0,0,1));case"mediumaquamarine":return new r(new _(102,205,170,1));case"mediumblue":return new r(new _(0,0,205,1));case"mediumorchid":return new r(new _(186,85,211,1));case"mediumpurple":return new r(new _(147,112,219,1));case"mediumseagreen":return new r(new _(60,179,113,1));case"mediumslateblue":return new r(new _(123,104,238,1));case"mediumspringgreen":return new r(new _(0,250,154,1));case"mediumturquoise":return new r(new _(72,209,204,1));case"mediumvioletred":return new r(new _(199,21,133,1));case"midnightblue":return new r(new _(25,25,112,1));case"mintcream":return new r(new _(245,255,250,1));case"mistyrose":return new r(new _(255,228,225,1));case"moccasin":return new r(new _(255,228,181,1));case"navajowhite":return new r(new _(255,222,173,1));case"navy":return new r(new _(0,0,128,1));case"oldlace":return new r(new _(253,245,230,1));case"olive":return new r(new _(128,128,0,1));case"olivedrab":return new r(new _(107,142,35,1));case"orange":return new r(new _(255,165,0,1));case"orangered":return new r(new _(255,69,0,1));case"orchid":return new r(new _(218,112,214,1));case"palegoldenrod":return new r(new _(238,232,170,1));case"palegreen":return new r(new _(152,251,152,1));case"paleturquoise":return new r(new _(175,238,238,1));case"palevioletred":return new r(new _(219,112,147,1));case"papayawhip":return new r(new _(255,239,213,1));case"peachpuff":return new r(new _(255,218,185,1));case"peru":return new r(new _(205,133,63,1));case"pink":return new r(new _(255,192,203,1));case"plum":return new r(new _(221,160,221,1));case"powderblue":return new r(new _(176,224,230,1));case"purple":return new r(new _(128,0,128,1));case"rebeccapurple":return new r(new _(102,51,153,1));case"red":return new r(new _(255,0,0,1));case"rosybrown":return new r(new _(188,143,143,1));case"royalblue":return new r(new _(65,105,225,1));case"saddlebrown":return new r(new _(139,69,19,1));case"salmon":return new r(new _(250,128,114,1));case"sandybrown":return new r(new _(244,164,96,1));case"seagreen":return new r(new _(46,139,87,1));case"seashell":return new r(new _(255,245,238,1));case"sienna":return new r(new _(160,82,45,1));case"silver":return new r(new _(192,192,192,1));case"skyblue":return new r(new _(135,206,235,1));case"slateblue":return new r(new _(106,90,205,1));case"slategray":return new r(new _(112,128,144,1));case"slategrey":return new r(new _(112,128,144,1));case"snow":return new r(new _(255,250,250,1));case"springgreen":return new r(new _(0,255,127,1));case"steelblue":return new r(new _(70,130,180,1));case"tan":return new r(new _(210,180,140,1));case"teal":return new r(new _(0,128,128,1));case"thistle":return new r(new _(216,191,216,1));case"tomato":return new r(new _(255,99,71,1));case"turquoise":return new r(new _(64,224,208,1));case"violet":return new r(new _(238,130,238,1));case"wheat":return new r(new _(245,222,179,1));case"white":return new r(new _(255,255,255,1));case"whitesmoke":return new r(new _(245,245,245,1));case"yellow":return new r(new _(255,255,0,1));case"yellowgreen":return new r(new _(154,205,50,1));default:return null}}function y(I){let k=I.length;if(k===0||I.charCodeAt(0)!==35)return null;if(k===7){let R=16*v(I.charCodeAt(1))+v(I.charCodeAt(2)),D=16*v(I.charCodeAt(3))+v(I.charCodeAt(4)),F=16*v(I.charCodeAt(5))+v(I.charCodeAt(6));return new r(new _(R,D,F,1))}if(k===9){let R=16*v(I.charCodeAt(1))+v(I.charCodeAt(2)),D=16*v(I.charCodeAt(3))+v(I.charCodeAt(4)),F=16*v(I.charCodeAt(5))+v(I.charCodeAt(6)),ce=16*v(I.charCodeAt(7))+v(I.charCodeAt(8));return new r(new _(R,D,F,ce/255))}if(k===4){let R=v(I.charCodeAt(1)),D=v(I.charCodeAt(2)),F=v(I.charCodeAt(3));return new r(new _(16*R+R,16*D+D,16*F+F))}if(k===5){let R=v(I.charCodeAt(1)),D=v(I.charCodeAt(2)),F=v(I.charCodeAt(3)),ce=v(I.charCodeAt(4));return new r(new _(16*R+R,16*D+D,16*F+F,(16*ce+ce)/255))}return null}S.parseHex=y;function v(I){switch(I){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||={})})(o=r.Format||={})})(Ko||={})});var _e,Qt=w(()=>{Z();_e=W("productService")});var Pi,pl=w(()=>{Z();Pi=W("themeMainService")});import Cy from"electron";function fl(o,r,e,t){let n=o.get(Pi),i=o.get(_e),s=o.get(ge),a=o.get(Te),l=s.getValue("window"),c={backgroundColor:n.getBackgroundColor(),minWidth:Sy.WIDTH,minHeight:Sy.HEIGHT,title:i.nameLong,show:r.mode!==0&&r.mode!==3,x:r.x,y:r.y,width:r.width,height:r.height,webPreferences:{...t,enableWebSQL:!1,spellcheck:!1,zoomFactor:Yx(r.zoomLevel??l?.zoomLevel),autoplayPolicy:"user-gesture-required",enableBlinkFeatures:"HighlightAPI",sandbox:!0,enableDeprecatedPaste:!0},experimentalDarkMode:!0};if(M){let f=l?.border||"default";f==="system"&&(f="default"),f!=="default"&&(f==="off"?c.accentColor=!1:typeof f=="string"&&(c.accentColor=f))}if(ne?c.icon=U(a.appRoot,"resources/linux/code.png"):M&&(a.isBuilt?process.isEmbeddedApp&&(c.icon=U(a.appRoot,"resources/win32/sessions.ico")):c.icon=U(a.appRoot,"resources/win32/code_150x150.png")),V&&(c.acceptFirstMouse=!0,l?.clickThroughInactive===!1&&(c.acceptFirstMouse=!1)),e?.disableFullscreen?c.fullscreen=!1:V&&!lm(s)&&(c.fullscreenable=!1),V&&l?.nativeTabs===!0&&(c.tabbingIdentifier=i.nameShort),!Bo(s,e?.forceNativeTitlebar?"native":void 0)&&(c.titleBarStyle="hidden",V||(c.frame=!1),lu(s)))if(V)c.titleBarOverlay=!0;else{let f=n.getWindowSplash(void 0)?.colorInfo.titleBarBackground??n.getBackgroundColor(),m=Ko.fromHex(f).isDarker()?"#FFFFFF":"#000000";c.titleBarOverlay={height:29,color:f,symbolColor:m}}return e?.alwaysOnTop&&(c.alwaysOnTop=!0),c}function dm(o){let r,e=Number.MIN_VALUE;for(let t of o)t.lastFocusTime>e&&(e=t.lastFocusTime,r=t);return r}function Ei(){return Cy.BrowserWindow.getAllWindows().filter(o=>!o.webContents.isOffscreen())}var Le,ml,Wt=w(()=>{Ty();Se();Y();st();Ot();Z();Qt();pl();no();xi();Le=W("windowsMainService");(t=>{function o(n,i,s=Cy.screen.getAllDisplays()){if(n.trace(`window#validateWindowState: validating window state on ${s.length} display(s)`,i),typeof i.x!="number"||typeof i.y!="number"||typeof i.width!="number"||typeof i.height!="number"){n.trace("window#validateWindowState: unexpected type of state values");return}if(i.width<=0||i.height<=0){n.trace("window#validateWindowState: unexpected negative values");return}if(s.length===1){let c=e(s[0]);if(n.trace("window#validateWindowState: single monitor working area",c),c){let d=function(){!i||typeof i.x!="number"||typeof i.y!="number"||!c||(i.x<c.x&&(i.x=c.x),i.y<c.y&&(i.y=c.y))};d(),i.width>c.width&&(i.width=c.width),i.height>c.height&&(i.height=c.height),i.x>c.x+c.width-128&&(i.x=c.x+c.width-i.width),i.y>c.y+c.height-128&&(i.y=c.y+c.height-i.height),d()}return i}if(i.display&&i.mode===3){let c=s.find(d=>d.id===i.display);if(c&&typeof c.bounds?.x=="number"&&typeof c.bounds?.y=="number"){n.trace("window#validateWindowState: restoring fullscreen to previous display");let d=Si(3);return d.x=c.bounds.x,d.y=c.bounds.y,d}}let a,l;try{a=Cy.screen.getDisplayMatching({x:i.x,y:i.y,width:i.width,height:i.height}),l=e(a),n.trace("window#validateWindowState: multi-monitor working area",l)}catch(c){n.error("window#validateWindowState: error finding display for window state",c)}if(a&&r(i,a))return i;n.trace("window#validateWindowState: state is outside of the multi-monitor working area")}t.validateWindowState=o;function r(n,i){if(typeof n.x!="number"||typeof n.y!="number"||typeof n.width!="number"||typeof n.height!="number"||n.width<=0||n.height<=0)return!1;let s=e(i);return!!(s&&n.x+n.width>s.x&&n.y+n.height>s.y&&n.x<s.x+s.width&&n.y<s.y+s.height)}t.validateWindowStateOnDisplay=r;function e(n){if(n.workArea.width>0&&n.workArea.height>0)return n.workArea;if(n.bounds.width>0&&n.bounds.height>0)return n.bounds}})(ml||={})});import _n from"electron";var me,Ti,xt=w(()=>{Qn();he();Q();K();Y();Bn();We();Z();re();Jr();xi();Ot();Wt();me=W("lifecycleMainService"),Ti=class extends C{constructor(e,t,n){super();this.logService=e;this.stateService=t;this.environmentMainService=n;this._onBeforeShutdown=this._register(new x);this.onBeforeShutdown=this._onBeforeShutdown.event;this._onWillShutdown=this._register(new x);this.onWillShutdown=this._onWillShutdown.event;this._onWillLoadWindow=this._register(new x);this.onWillLoadWindow=this._onWillLoadWindow.event;this._onBeforeCloseWindow=this._register(new x);this.onBeforeCloseWindow=this._onBeforeCloseWindow.event;this._quitRequested=!1;this._wasRestarted=!1;this._phase=1;this.windowToCloseRequest=new Set;this.oneTimeListenerTokenGenerator=0;this.windowCounter=0;this.pendingQuitPromise=void 0;this.pendingQuitPromiseResolve=void 0;this.pendingWillShutdownPromise=void 0;this.mapWindowIdToPendingUnload=new Map;this.phaseWhen=new Map;this.relaunchHandler=void 0;this.resolveRestarted(),this.when(2).then(()=>this.registerListeners())}static{this.QUIT_AND_RESTART_KEY="lifecycle.quitAndRestart"}get quitRequested(){return this._quitRequested}get wasRestarted(){return this._wasRestarted}get phase(){return this._phase}resolveRestarted(){this._wasRestarted=!!this.stateService.getItem(Ti.QUIT_AND_RESTART_KEY),this._wasRestarted&&this.stateService.removeItem(Ti.QUIT_AND_RESTART_KEY)}registerListeners(){let e=()=>{this._quitRequested||(this.trace("Lifecycle#app.on(before-quit)"),this._quitRequested=!0,this.trace("Lifecycle#onBeforeShutdown.fire()"),this._onBeforeShutdown.fire(),V&&this.windowCounter===0&&this.fireOnWillShutdown(1))};_n.app.addListener("before-quit",e);let t=()=>{this.trace("Lifecycle#app.on(window-all-closed)"),(this._quitRequested||!V)&&_n.app.quit()};_n.app.addListener("window-all-closed",t),_n.app.once("will-quit",n=>{this.trace("Lifecycle#app.on(will-quit) - begin"),n.preventDefault(),this.fireOnWillShutdown(1).finally(()=>{this.trace("Lifecycle#app.on(will-quit) - after fireOnWillShutdown"),this.resolvePendingQuitPromise(!1),_n.app.removeListener("before-quit",e),_n.app.removeListener("window-all-closed",t),this.trace("Lifecycle#app.on(will-quit) - calling app.quit()"),_n.app.quit()})})}fireOnWillShutdown(e){if(this.pendingWillShutdownPromise)return this.pendingWillShutdownPromise;let t=this.logService;this.trace("Lifecycle#onWillShutdown.fire()");let n=[];return this._onWillShutdown.fire({reason:e,join(i,s){t.trace(`Lifecycle#onWillShutdown - begin '${i}'`),n.push(s.finally(()=>{t.trace(`Lifecycle#onWillShutdown - end '${i}'`)}))}}),this.pendingWillShutdownPromise=(async()=>{try{await wt.settled(n)}catch(i){this.logService.error(i)}try{await this.stateService.close()}catch(i){this.logService.error(i)}})(),this.pendingWillShutdownPromise}set phase(e){if(e<this.phase)throw new Error("Lifecycle cannot go backwards");if(this._phase===e)return;this.trace(`lifecycle (main): phase changed (value: ${e})`),this._phase=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 mi,this.phaseWhen.set(e,t)),await t.wait()}registerWindow(e){let t=new te;this.windowCounter++,t.add(e.onWillLoad(i=>this._onWillLoadWindow.fire({window:e,workspace:i.workspace,reason:i.reason})));let n=ui(e.win);t.add(E.fromNodeEventEmitter(n,"close")(i=>{let s=e.id;this.windowToCloseRequest.delete(s)||(this.trace(`Lifecycle#window.on('close') - window ID ${e.id}`),i.preventDefault(),this.unload(e,1).then(a=>{if(a){this.windowToCloseRequest.delete(s);return}this.windowToCloseRequest.add(s),this.trace(`Lifecycle#onBeforeCloseWindow.fire() - window ID ${s}`),this._onBeforeCloseWindow.fire(e),e.close()}))})),t.add(E.fromNodeEventEmitter(n,"closed")(()=>{this.trace(`Lifecycle#window.on('closed') - window ID ${e.id}`),this.windowCounter--,t.dispose(),this.windowCounter===0&&(!V||this._quitRequested)&&this.fireOnWillShutdown(1)}))}registerAuxWindow(e){let t=ui(e.win),n=new te;n.add(E.fromNodeEventEmitter(t,"close")(i=>{this.trace(`Lifecycle#auxWindow.on('close') - window ID ${e.id}`),this._quitRequested&&(this.trace("Lifecycle#auxWindow.on('close') - preventDefault() because quit requested"),i.preventDefault())})),n.add(E.fromNodeEventEmitter(t,"closed")(()=>{this.trace(`Lifecycle#auxWindow.on('closed') - window ID ${e.id}`),n.dispose()}))}async reload(e,t){await this.unload(e,3)||e.reload(t)}unload(e,t){let n=this.mapWindowIdToPendingUnload.get(e.id);if(n)return n;let i=this.doUnload(e,t).finally(()=>{this.mapWindowIdToPendingUnload.delete(e.id)});return this.mapWindowIdToPendingUnload.set(e.id,i),i}async doUnload(e,t){if(!e.isReady)return!1;this.trace(`Lifecycle#unload() - window ID ${e.id}`);let n=this._quitRequested?2:t,i=await this.onBeforeUnloadWindowInRenderer(e,n);return i?(this.trace(`Lifecycle#unload() - veto in renderer (window ID ${e.id})`),this.handleWindowUnloadVeto(i)):(await this.onWillUnloadWindowInRenderer(e,n),!1)}handleWindowUnloadVeto(e){return e?(this.resolvePendingQuitPromise(!0),this._quitRequested=!1,!0):!1}resolvePendingQuitPromise(e){this.pendingQuitPromiseResolve&&(this.pendingQuitPromiseResolve(e),this.pendingQuitPromiseResolve=void 0,this.pendingQuitPromise=void 0)}onBeforeUnloadWindowInRenderer(e,t){return new Promise(n=>{let i=this.oneTimeListenerTokenGenerator++,s=`vscode:ok${i}`,a=`vscode:cancel${i}`;ct.once(s,()=>{n(!1)}),ct.once(a,()=>{n(!0)}),e.send("vscode:onBeforeUnload",{okChannel:s,cancelChannel:a,reason:t})})}onWillUnloadWindowInRenderer(e,t){return new Promise(n=>{let s=`vscode:reply${this.oneTimeListenerTokenGenerator++}`;ct.once(s,()=>n()),e.send("vscode:onWillUnload",{replyChannel:s,reason:t})})}quit(e){return this.doQuit(e).then(t=>{if(!t&&e)try{if(M){let n=mn();n!==process.cwd()&&process.chdir(n)}}catch(n){this.logService.error(n)}return t})}doQuit(e){return this.trace(`Lifecycle#quit() - begin (willRestart: ${e})`),this.pendingQuitPromise?(this.trace("Lifecycle#quit() - returning pending quit promise"),this.pendingQuitPromise):(e&&this.stateService.setItem(Ti.QUIT_AND_RESTART_KEY,!0),this.pendingQuitPromise=new Promise(t=>{this.pendingQuitPromiseResolve=t,this.trace("Lifecycle#quit() - calling app.quit()"),_n.app.quit()}),this.pendingQuitPromise)}trace(e){this.environmentMainService.args["enable-smoke-test-driver"]?this.logService.info(e):this.logService.trace(e)}setRelaunchHandler(e){this.relaunchHandler=e}async relaunch(e){this.trace("Lifecycle#relaunch()");let t=process.argv.slice(1);if(e?.addArgs&&t.push(...e.addArgs),e?.removeArgs)for(let s of e.removeArgs){let a=t.indexOf(s);a>=0&&t.splice(a,1)}let n=()=>{this.relaunchHandler?.handleRelaunch(e)||(this.trace("Lifecycle#relaunch() - calling app.relaunch()"),_n.app.relaunch({args:t}))};_n.app.once("quit",n),await this.quit(!0)&&_n.app.removeListener("quit",n)}async kill(e){this.trace("Lifecycle#kill()"),await this.fireOnWillShutdown(2),await Promise.race([lt(1e3),(async()=>{for(let t of Ei())if(t&&!t.isDestroyed()){let n;t.webContents&&!t.webContents.isDestroyed()?n=new Promise(i=>t.once("closed",i)):n=Promise.resolve(),t.destroy(),await n}})()]),_n.app.exit(e)}};Ti=T([g(0,O),g(1,ft),g(2,Te)],Ti)});import*as _y from"fs";var $s,ky,nP=w(()=>{he();Q();Lr();Se();jt();$s=class o{constructor(r,e=Object.create(null)){this.path=r;this.name=ye(this.path),this.logger=new ky(e.logging),this.whenConnected=this.connect(this.path)}static{this.IN_MEMORY_PATH=":memory:"}get onDidChangeItemsExternal(){return E.None}static{this.BUSY_OPEN_TIMEOUT=2e3}static{this.MAX_HOST_PARAMETERS=256}async getItems(){let r=await this.whenConnected,e=new Map;return(await this.all(r,"SELECT * FROM ItemTable")).forEach(n=>e.set(n.key,n.value)),this.logger.isTracing&&this.logger.trace(`[storage ${this.name}] getItems(): ${e.size} rows`),e}async updateItems(r){let e=await this.whenConnected;return this.doUpdateItems(e,r)}doUpdateItems(r,e){return this.logger.isTracing&&this.logger.trace(`[storage ${this.name}] updateItems(): insert(${e.insert?PS(e.insert):"0"}), delete(${e.delete?ES(e.delete):"0"})`),this.transaction(r,()=>{let t=e.insert,n=e.delete;if(t&&t.size>0){let i=[];i.push([]);let s=0;t.forEach((a,l)=>{let c=i[s];c.length>o.MAX_HOST_PARAMETERS&&(s++,c=[],i.push(c)),c.push(l,a)}),i.forEach(a=>{this.prepare(r,`INSERT INTO ItemTable VALUES ${new Array(a.length/2).fill("(?,?)").join(",")} ON CONFLICT (key) DO UPDATE SET value = excluded.value WHERE value != excluded.value`,l=>l.run(a),()=>{let l=[],c=0;return t.forEach((d,u)=>{l.push(u),c+=d.length}),`Keys: ${l.join(", ")} Length: ${c}`})})}if(n?.size){let i=[];i.push([]);let s=0;n.forEach(a=>{let l=i[s];l.length>o.MAX_HOST_PARAMETERS&&(s++,l=[],i.push(l)),l.push(a)}),i.forEach(a=>{this.prepare(r,`DELETE FROM ItemTable WHERE key IN (${new Array(a.length).fill("?").join(",")})`,l=>l.run(a),()=>{let l=[];return n.forEach(c=>{l.push(c)}),`Keys: ${l.join(", ")}`})})}})}async optimize(){this.logger.trace(`[storage ${this.name}] vacuum()`);let r=await this.whenConnected;return this.exec(r,"VACUUM")}async close(r){this.logger.trace(`[storage ${this.name}] close()`);let e=await this.whenConnected;return this.doClose(e,r)}doClose(r,e){return new Promise((t,n)=>{r.db.close(i=>(i&&this.handleSQLiteError(r,`[storage ${this.name}] close(): ${i}`),this.path===o.IN_MEMORY_PATH?t():!r.isErroneous&&!r.isInMemory?this.backup().then(t,s=>(this.logger.error(`[storage ${this.name}] backup(): ${s}`),t())):typeof e=="function"?_y.promises.unlink(this.path).then(()=>this.doConnect(this.path).then(s=>{let a=()=>this.doClose(s,void 0);return this.doUpdateItems(s,{insert:e()}).then(()=>a(),l=>(a(),Promise.reject(l)))})).then(t,n):n(i||new Error("Database has errors or is in-memory without recovery option"))))})}backup(){let r=this.toBackupPath(this.path);return q.copy(this.path,r,{preserveSymlinks:!1})}toBackupPath(r){return`${r}.backup`}async checkIntegrity(r){this.logger.trace(`[storage ${this.name}] checkIntegrity(full: ${r})`);let e=await this.whenConnected,t=await this.get(e,r?"PRAGMA integrity_check":"PRAGMA quick_check"),n=r?t.integrity_check:t.quick_check;return e.isErroneous?`${n} (last error: ${e.lastError})`:e.isInMemory?`${n} (in-memory!)`:n}async connect(r,e=!0){this.logger.trace(`[storage ${this.name}] open(${r}, retryOnBusy: ${e})`);try{return await this.doConnect(r)}catch(t){if(this.logger.error(`[storage ${this.name}] open(): Unable to open DB due to ${t}`),t.code==="SQLITE_BUSY"&&e)return await lt(o.BUSY_OPEN_TIMEOUT),this.connect(r,!1);try{await _y.promises.unlink(r);try{await q.rename(this.toBackupPath(r),r,!1)}catch{}return await this.doConnect(r)}catch(n){return this.logger.error(`[storage ${this.name}] open(): Unable to use backup due to ${n}`),this.doConnect(o.IN_MEMORY_PATH)}}}handleSQLiteError(r,e){r.isErroneous=!0,r.lastError=e,this.logger.error(e)}doConnect(r){return new Promise((e,t)=>{import("@vscode/sqlite3").then(n=>{let i=this.logger.isTracing?n.default.verbose().Database:n.default.Database,s={db:new i(r,a=>a?s.db&&a.code!=="SQLITE_CANTOPEN"?s.db.close(()=>t(a)):t(a):this.exec(s,["PRAGMA user_version = 1;","CREATE TABLE IF NOT EXISTS ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB)"].join("")).then(()=>e(s),l=>s.db.close(()=>t(l)))),isInMemory:r===o.IN_MEMORY_PATH};s.db.on("error",a=>this.handleSQLiteError(s,`[storage ${this.name}] Error (event): ${a}`)),this.logger.isTracing&&s.db.on("trace",a=>this.logger.trace(`[storage ${this.name}] Trace (event): ${a}`))},t)})}exec(r,e){return new Promise((t,n)=>{r.db.exec(e,i=>i?(this.handleSQLiteError(r,`[storage ${this.name}] exec(): ${i}`),n(i)):t())})}get(r,e){return new Promise((t,n)=>{r.db.get(e,(i,s)=>i?(this.handleSQLiteError(r,`[storage ${this.name}] get(): ${i}`),n(i)):t(s))})}all(r,e){return new Promise((t,n)=>{r.db.all(e,(i,s)=>i?(this.handleSQLiteError(r,`[storage ${this.name}] all(): ${i}`),n(i)):t(s))})}transaction(r,e){return new Promise((t,n)=>{r.db.serialize(()=>{r.db.run("BEGIN TRANSACTION"),e(),r.db.run("END TRANSACTION",i=>i?(this.handleSQLiteError(r,`[storage ${this.name}] transaction(): ${i}`),n(i)):t())})})}prepare(r,e,t,n){let i=r.db.prepare(e),s=a=>{this.handleSQLiteError(r,`[storage ${this.name}] prepare(): ${a} (${e}). Details: ${n()}`)};i.on("error",s),t(i),i.finalize(a=>{a&&s(a),i.removeListener("error",s)})}},ky=class o{static{this.VSCODE_TRACE_STORAGE="VSCODE_TRACE_STORAGE"}constructor(r){r&&typeof r.logTrace=="function"&&process.env[o.VSCODE_TRACE_STORAGE]&&(this.logTrace=r.logTrace),r&&typeof r.logError=="function"&&(this.logError=r.logError)}get isTracing(){return!!this.logTrace}trace(r){this.logTrace?.(r)}error(r){this.logError?.(r)}}});var ot,y6,Ry,Dy,iP,um,pm,cu,oP,hl,fm,du,ir=w(()=>{Z();ot=W("telemetryService"),y6=W("customEndpointTelemetryService"),Ry="telemetry.currentSessionDate",Dy="telemetry.firstSessionDate",iP="telemetry.lastSessionDate",um="telemetry.machineId",pm="telemetry.sqmId",cu="telemetry.devDeviceId",oP="telemetry",hl="telemetry.telemetryLevel",fm="telemetry.enableCrashReporter",du="telemetry.enableTelemetry"});import*as sP from"fs";var uu,mm,hm,gm,vm,pu,aP=w(()=>{zt();he();Q();K();Se();xs();se();jt();my();nP();re();Hs();ir();hr();ze();uu=class o extends C{constructor(e,t){super();this.logService=e;this.fileService=t;this._onDidChangeStorage=this._register(new x);this.onDidChangeStorage=this._onDidChangeStorage.event;this._onDidCloseStorage=this._register(new x);this.onDidCloseStorage=this._onDidCloseStorage.event;this._storage=this._register(new Uo(new il,{hint:1}));this.initializePromise=void 0;this.whenInitPromise=new Gt;this.whenInit=this.whenInitPromise.p;this.state=0}static{this.LOG_SLOW_CLOSE_THRESHOLD=2e3}get storage(){return this._storage}isInMemory(){return this._storage.isInMemory()}init(){return this.initializePromise||(this.initializePromise=(async()=>{if(this.state===0)try{let e=this._register(await this.doCreate());this._storage.dispose(),this._storage=e,this._register(e.onDidChangeStorage(n=>this._onDidChangeStorage.fire(n))),await this.doInit(e);let t=e.getBoolean(au);t===void 0?e.set(au,!0):t&&e.set(au,!1)}catch(e){this.logService.error(`[storage main] initialize(): Unable to init storage due to ${e}`)}finally{this.state=1,this.whenInitPromise.complete()}})()),this.initializePromise}createLoggingOptions(){return{logTrace:this.logService.getLevel()===1?e=>this.logService.trace(e):void 0,logError:e=>this.logService.error(e)}}doInit(e){return e.init()}get items(){return this._storage.items}get(e,t){return this._storage.get(e,t)}set(e,t){return this._storage.set(e,t)}delete(e){return this._storage.delete(e)}optimize(){return this._storage.optimize()}async close(){let e=new sn(!1);await this.doClose(),e.stop(),e.elapsed()>o.LOG_SLOW_CLOSE_THRESHOLD&&await this.logSlowClose(e),this._onDidCloseStorage.fire()}async logSlowClose(e){if(this.path)try{let t=hS(Array.from(this._storage.items.entries()).map(([i,s])=>({key:i,length:s.length})),(i,s)=>s.length-i.length,5).map(i=>`${i.key}:${i.length}`).join(", "),n=(await this.fileService.stat(b.file(this.path))).size;this.logService.warn(`[storage main] detected slow close() operation: Time: ${e.elapsed()}ms, DB size: ${n}b, Large Keys: ${t}`)}catch(t){this.logService.error("[storage main] figuring out stats for slow DB on close() resulted in an error",t)}}async doClose(){this.initializePromise&&await this.initializePromise,this.state=2,await this._storage.close()}},mm=class o extends uu{constructor(e,t,n,i){super(n,i);this.profile=e;this.options=t}static{this.STORAGE_NAME="state.vscdb"}get path(){if(!this.options.useInMemoryStorage)return U(this.profile.globalStorageHome.with({scheme:N.file}).fsPath,o.STORAGE_NAME)}async doCreate(){return new Uo(new $s(this.path??$s.IN_MEMORY_PATH,{logging:this.createLoggingOptions()}),this.path?void 0:{hint:1})}},hm=class extends mm{},gm=class extends mm{constructor(r,e,t,n){super(e.defaultProfile,r,t,n)}async doInit(r){await super.doInit(r),this.updateTelemetryState(r)}updateTelemetryState(r){r.get(Dy,void 0)===void 0&&r.set(Dy,new Date().toUTCString());let t=r.get(Ry,void 0),n=new Date().toUTCString();r.set(iP,typeof t>"u"?null:t),r.set(Ry,n)}},vm=class o extends uu{constructor(e,t,n,i,s){super(n,s);this.workspace=e;this.options=t;this.environmentService=i}static{this.WORKSPACE_STORAGE_NAME="state.vscdb"}static{this.WORKSPACE_META_NAME="workspace.json"}get path(){if(!this.options.useInMemoryStorage)return U(this.environmentService.workspaceStorageHome.with({scheme:N.file}).fsPath,this.workspace.id,o.WORKSPACE_STORAGE_NAME)}async doCreate(){let{storageFilePath:e,wasCreated:t}=await this.prepareWorkspaceStorageFolder();return new Uo(new $s(e,{logging:this.createLoggingOptions()}),{hint:this.options.useInMemoryStorage?1:t?0:void 0})}async prepareWorkspaceStorageFolder(){if(this.options.useInMemoryStorage)return{storageFilePath:$s.IN_MEMORY_PATH,wasCreated:!0};let e=U(this.environmentService.workspaceStorageHome.with({scheme:N.file}).fsPath,this.workspace.id),t=U(e,o.WORKSPACE_STORAGE_NAME);return await q.exists(e)?{storageFilePath:t,wasCreated:!1}:(await sP.promises.mkdir(e,{recursive:!0}),this.ensureWorkspaceStorageFolderMeta(e),{storageFilePath:t,wasCreated:!0})}async ensureWorkspaceStorageFolderMeta(e){let t;if(Rt(this.workspace)?t={folder:this.workspace.uri.toString()}:it(this.workspace)&&(t={workspace:this.workspace.configPath.toString()}),t)try{let n=U(e,o.WORKSPACE_META_NAME);await q.exists(n)||await q.writeFile(n,JSON.stringify(t,void 0,2))}catch(n){this.logService.error(`[storage main] ensureWorkspaceStorageFolderMeta(): Unable to create workspace storage metadata due to ${n}`)}}},pu=class extends uu{get path(){}async doCreate(){return new Uo(new il,{hint:1})}}});var Wy,fu,vl,Ly=w(()=>{he();nt();K();We();qr();je();re();Wy=class extends C{constructor(e,t,n,i){super();this.storagePath=e;this.logService=n;this.fileService=i;this.storage=Object.create(null);this.lastSavedStorageContents="";this.initializing=void 0;this.closing=void 0;this.flushDelayer=this._register(new Pr(t===0?0:100))}init(){return this.initializing||(this.initializing=this.doInit()),this.initializing}async doInit(){try{this.lastSavedStorageContents=(await this.fileService.readFile(this.storagePath)).value.toString(),this.storage=JSON.parse(this.lastSavedStorageContents)}catch(e){e.fileOperationResult!==1&&this.logService.error(e)}}getItem(e,t){let n=this.storage[e];return At(n)?t:n}setItem(e,t){this.setItems([{key:e,data:t}])}setItems(e){let t=!1;for(let{key:n,data:i}of e)this.storage[n]!==i&&(At(i)?En(this.storage[n])||(this.storage[n]=void 0,t=!0):(this.storage[n]=i,t=!0));t&&this.save()}removeItem(e){En(this.storage[e])||(this.storage[e]=void 0,this.save())}async save(){if(!this.closing)return this.flushDelayer.trigger(()=>this.doSave())}async doSave(){if(!this.initializing)return;await this.initializing;let e=JSON.stringify(this.storage,null,4);if(e!==this.lastSavedStorageContents)try{await this.fileService.writeFile(this.storagePath,H.fromString(e),{atomic:{postfix:".vsctmp"}}),this.lastSavedStorageContents=e}catch(t){this.logService.error(t)}}async close(){return this.closing||(this.closing=this.flushDelayer.trigger(()=>this.doSave(),0)),this.closing}},fu=class extends C{constructor(r,e,t,n){super(),this.fileStorage=this._register(new Wy(e.stateResource,r,t,n))}async init(){await this.fileStorage.init()}getItem(r,e){return this.fileStorage.getItem(r,e)}};fu=T([g(1,$r),g(2,O),g(3,ke)],fu);vl=class extends fu{setItem(r,e){this.fileStorage.setItem(r,e)}setItems(r){this.fileStorage.setItems(r)}removeItem(r){this.fileStorage.removeItem(r)}close(){return this.fileStorage.close()}}});var $o,kn,ym,lP=w(()=>{se();qr();je();re();Jr();Xn();Yn();We();Ly();$o=class extends cl{constructor(e,t,n,i,s){super(n,i,t,s);this.stateReadonlyService=e;this.nativeEnvironmentService=n}getStoredProfiles(){return this.stateReadonlyService.getItem($o.PROFILES_KEY,[]).map(t=>({...t,location:Ae(t.location)?this.uriIdentityService.extUri.joinPath(this.profilesHome,t.location):b.revive(t.location)}))}getStoredProfileAssociations(){return this.stateReadonlyService.getItem($o.PROFILE_ASSOCIATIONS_KEY,{})}getDefaultProfileExtensionsLocation(){return this.uriIdentityService.extUri.joinPath(b.file(this.nativeEnvironmentService.extensionsPath).with({scheme:this.profilesHome.scheme}),"extensions.json")}};$o=T([g(0,am),g(1,Dt),g(2,fr),g(3,ke),g(4,O)],$o);kn=class extends $o{constructor(e,t,n,i,s){super(e,t,n,i,s);this.stateService=e}saveStoredProfiles(e){e.length?this.stateService.setItem(kn.PROFILES_KEY,e.map(t=>({...t,location:this.uriIdentityService.extUri.relativePath(this.profilesHome,t.location)}))):this.stateService.removeItem(kn.PROFILES_KEY)}saveStoredProfileAssociations(e){e.emptyWindows||e.workspaces?this.stateService.setItem(kn.PROFILE_ASSOCIATIONS_KEY,e):this.stateService.removeItem(kn.PROFILE_ASSOCIATIONS_KEY)}};kn=T([g(0,ft),g(1,Dt),g(2,fr),g(3,ke),g(4,O)],kn);ym=class extends kn{constructor(r,e,t,n){super(new vl(0,e,n,t),r,e,t,n)}async init(){return await this.stateService.init(),super.init()}};ym=T([g(0,Dt),g(1,fr),g(2,ke),g(3,O)],ym)});var Or,yl,qo=w(()=>{qr();je();Z();re();Xn();Yn();lP();Jr();Or=_r,yl=class extends kn{constructor(r,e,t,n,i){super(r,e,t,n,i)}getAssociatedEmptyWindows(){let r=[];for(let e of this.profilesObject.emptyWindows.keys())r.push({id:e});return r}};yl=T([g(0,ft),g(1,Dt),g(2,fr),g(3,ke),g(4,O)],yl)});var qs,wl,zo,Il,hu=w(()=>{se();Q();K();qr();je();Z();xt();re();Hs();aP();Yn();qo();Xn();ze();qs=W("storageMainService"),wl=class extends C{constructor(e,t,n,i,s,a){super();this.logService=e;this.environmentService=t;this.userDataProfilesService=n;this.lifecycleMainService=i;this.fileService=s;this.uriIdentityService=a;this.shutdownReason=void 0;this._onDidChangeProfileStorage=this._register(new x);this.onDidChangeProfileStorage=this._onDidChangeProfileStorage.event;this.mapProfileToStorage=new Map;this.mapWorkspaceToStorage=new Map;this.applicationStorage=this._register(this.createApplicationStorage()),this.registerListeners()}getStorageOptions(){return{useInMemoryStorage:!!this.environmentService.extensionTestsLocationURI}}registerListeners(){(async()=>(await this.lifecycleMainService.when(3),this.applicationStorage.init()))(),this._register(this.lifecycleMainService.onWillLoadWindow(e=>{e.window.profile&&this.profileStorage(e.window.profile).init(),e.workspace&&this.workspaceStorage(e.workspace).init()})),this._register(this.lifecycleMainService.onWillShutdown(e=>{this.logService.trace("storageMainService#onWillShutdown()"),this.shutdownReason=e.reason,e.join("applicationStorage",this.applicationStorage.close());for(let[,t]of this.mapProfileToStorage)e.join("profileStorage",t.close());for(let[,t]of this.mapWorkspaceToStorage)e.join("workspaceStorage",t.close())})),this._register(this.userDataProfilesService.onWillCreateProfile(e=>{e.join((async()=>{await this.fileService.exists(e.profile.globalStorageHome)||await this.fileService.createFolder(e.profile.globalStorageHome)})())})),this._register(this.userDataProfilesService.onWillRemoveProfile(e=>{let t=this.mapProfileToStorage.get(e.profile.id);t&&e.join(t.close())}))}createApplicationStorage(){this.logService.trace("StorageMainService: creating application storage");let e=new gm(this.getStorageOptions(),this.userDataProfilesService,this.logService,this.fileService);return this._register(E.once(e.onDidCloseStorage)(()=>{this.logService.trace("StorageMainService: closed application storage")})),e}profileStorage(e){if(om(e))return this.applicationStorage;let t=this.mapProfileToStorage.get(e.id);if(!t){this.logService.trace(`StorageMainService: creating profile storage (${e.name})`),t=this._register(this.createProfileStorage(e)),this.mapProfileToStorage.set(e.id,t);let n=t.onDidChangeStorage(i=>this._onDidChangeProfileStorage.fire({...i,storage:t,profile:e}));E.once(t.onDidCloseStorage)(()=>{this.logService.trace(`StorageMainService: closed profile storage (${e.name})`),this.mapProfileToStorage.delete(e.id),n.dispose()})}return t}createProfileStorage(e){return this.shutdownReason===2?new pu(this.logService,this.fileService):new hm(e,this.getStorageOptions(),this.logService,this.fileService)}workspaceStorage(e){let t=this.mapWorkspaceToStorage.get(e.id);return t||(this.logService.trace(`StorageMainService: creating workspace storage (${e.id})`),t=this._register(this.createWorkspaceStorage(e)),this.mapWorkspaceToStorage.set(e.id,t),E.once(t.onDidCloseStorage)(()=>{this.logService.trace(`StorageMainService: closed workspace storage (${e.id})`),this.mapWorkspaceToStorage.delete(e.id)})),t}createWorkspaceStorage(e){return this.shutdownReason===2?new pu(this.logService,this.fileService):new vm(e,this.getStorageOptions(),this.logService,this.environmentService,this.fileService)}isUsed(e){let t=b.file(e);for(let n of[this.applicationStorage,...this.mapProfileToStorage.values(),...this.mapWorkspaceToStorage.values()])if(n.path&&this.uriIdentityService.extUri.isEqualOrParent(b.file(n.path),t))return!0;return!1}};wl=T([g(0,O),g(1,$r),g(2,Or),g(3,me),g(4,ke),g(5,Dt)],wl);zo=W("applicationStorageMainService"),Il=class extends im{constructor(e,t){super();this.userDataProfilesService=e;this.storageMainService=t;this.whenReady=this.storageMainService.applicationStorage.whenInit}doInitialize(){return this.storageMainService.applicationStorage.whenInit}getStorage(e){if(e===-1)return this.storageMainService.applicationStorage.storage}getLogDetails(e){if(e===-1)return this.userDataProfilesService.defaultProfile.globalStorageHome.with({scheme:N.file}).fsPath}shouldFlushWhenIdle(){return!1}switch(){throw new Error("Migrating storage is unsupported from main process")}switchToProfile(){throw new Error("Switching storage profile is unsupported from main process")}switchToWorkspace(){throw new Error("Switching storage workspace is unsupported from main process")}hasScope(){throw new Error("Main process is never profile or workspace scoped")}};Il=T([g(0,_r),g(1,qs)],Il)});import{app as U2}from"electron";var gu,bl,Ay=w(()=>{St();Q();yi();K();se();Mt();st();Of();Ot();Z();re();Hs();hu();Wt();gu=W("proxyAuthService"),bl=class extends C{constructor(e,t,n,i,s,a){super();this.logService=e;this.windowsMainService=t;this.encryptionMainService=n;this.applicationStorageMainService=i;this.configurationService=s;this.environmentMainService=a;this.PROXY_CREDENTIALS_SERVICE_KEY="proxy-credentials://";this.pendingProxyResolves=new Map;this.currentDialog=void 0;this.cancelledAuthInfoHashes=new Set;this.sessionCredentials=new Map;this.registerListeners()}registerListeners(){let e=E.fromNodeEventEmitter(U2,"login",(t,n,i,s,a)=>({event:t,authInfo:{...s,attempt:i.firstAuthAttempt?1:2},callback:a}));this._register(e(this.onLogin,this))}async lookupAuthorization(e){return this.onLogin({authInfo:e})}async onLogin({event:e,authInfo:t,callback:n}){if(!t.isProxy)return;e?.preventDefault();let i=String(rr({scheme:t.scheme,host:t.host,port:t.port})),s,a=this.pendingProxyResolves.get(i);if(a)this.logService.trace("auth#onLogin (proxy) - pending proxy handling found"),s=await a;else{this.logService.trace("auth#onLogin (proxy) - no pending proxy handling found, starting new"),a=this.resolveProxyCredentials(t,i),this.pendingProxyResolves.set(i,a);try{s=await a}finally{this.pendingProxyResolves.delete(i)}}return n?.(s?.username,s?.password),s}async resolveProxyCredentials(e,t){this.logService.trace("auth#resolveProxyCredentials (proxy) - enter");try{let n=await this.doResolveProxyCredentials(e,t);if(n)return this.logService.trace("auth#resolveProxyCredentials (proxy) - got credentials"),n;this.logService.trace("auth#resolveProxyCredentials (proxy) - did not get credentials")}finally{this.logService.trace("auth#resolveProxyCredentials (proxy) - exit")}}async doResolveProxyCredentials(e,t){if(this.logService.trace("auth#doResolveProxyCredentials - enter",e),this.environmentMainService.extensionTestsLocationURI){try{let d=Buffer.from(e.realm,"base64").toString("utf-8");if(d.startsWith("{"))return JSON.parse(d)}catch{}return}let n=(this.configurationService.getValue("http.proxy")||"").trim()||(process.env.https_proxy||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.HTTP_PROXY||"").trim()||void 0;if(n?.indexOf("@")!==-1){let d=b.parse(n),u=d.authority.indexOf("@");if(u!==-1){if(e.attempt>1){this.logService.trace("auth#doResolveProxyCredentials (proxy) - exit - ignoring previously used config/envvar credentials");return}this.logService.trace("auth#doResolveProxyCredentials (proxy) - exit - found config/envvar credentials to use");let f=d.authority.substring(0,u),m=f.indexOf(":");return m!==-1?{username:f.substring(0,m),password:f.substring(m+1)}:{username:f,password:""}}}let i=e.attempt===1&&this.sessionCredentials.get(t);if(i){this.logService.trace("auth#doResolveProxyCredentials (proxy) - exit - found session credentials to use");let{username:d,password:u}=i;return{username:d,password:u}}let s,a;try{let d=this.applicationStorageMainService.get(this.PROXY_CREDENTIALS_SERVICE_KEY+t,-1);if(d){let u=JSON.parse(await this.encryptionMainService.decrypt(d));s=u.username,a=u.password}}catch(d){this.logService.error(d)}if(e.attempt===1&&typeof s=="string"&&typeof a=="string")return this.logService.trace("auth#doResolveProxyCredentials (proxy) - exit - found stored credentials to use"),this.sessionCredentials.set(t,{username:s,password:a}),{username:s,password:a};let l=this.currentDialog,c=this.currentDialog=(async()=>{await l;let d=await this.showProxyCredentialsDialog(e,t,s,a);return this.currentDialog===c&&(this.currentDialog=void 0),d})();return c}async showProxyCredentialsDialog(e,t,n,i){if(this.cancelledAuthInfoHashes.has(t)){this.logService.trace("auth#doResolveProxyCredentials (proxy) - exit - login dialog was cancelled before, not showing again");return}let s=this.windowsMainService.getFocusedWindow()||this.windowsMainService.getLastActiveWindow();if(!s){this.logService.trace("auth#doResolveProxyCredentials (proxy) - exit - no opened window found to show dialog in");return}this.logService.trace(`auth#doResolveProxyCredentials (proxy) - asking window ${s.id} to handle proxy login`);let a=this.sessionCredentials.get(t),l={authInfo:e,username:a?.username??n,password:a?.password??i,replyChannel:`vscode:proxyAuthResponse:${xe()}`};s.sendWhenReady("vscode:openProxyAuthenticationDialog",be.None,l);let c=await new Promise(d=>{let u=async(f,m,y)=>{if(m===l.replyChannel)if(this.logService.trace(`auth#doResolveProxyCredentials - exit - received credentials from window ${s.id}`),s.win?.webContents.off("ipc-message",u),y){let v={username:y.username,password:y.password};try{if(y.remember){let S=await this.encryptionMainService.encrypt(JSON.stringify(v));this.applicationStorageMainService.store(this.PROXY_CREDENTIALS_SERVICE_KEY+t,S,-1,1)}else this.applicationStorageMainService.remove(this.PROXY_CREDENTIALS_SERVICE_KEY+t,-1)}catch(S){this.logService.error(S)}d({username:v.username,password:v.password})}else this.cancelledAuthInfoHashes.add(t),d(void 0)};s.win?.webContents.on("ipc-message",u)});return this.sessionCredentials.set(t,c),c}};bl=T([g(0,O),g(1,Le),g(2,$d),g(3,zo),g(4,ge),g(5,Te)],bl)});var Ci,Sl=w(()=>{Z();Ci=W("backupMainService")});function dP(o){return typeof o?.backupFolder=="string"}function uP(o){let r=[];try{Array.isArray(o.workspaces)&&(r=o.workspaces.map(e=>({workspace:{id:e.id,configPath:b.parse(e.configURIPath)},remoteAuthority:e.remoteAuthority})))}catch{}return r}function pP(o){let r=[];try{Array.isArray(o.folders)&&(r=o.folders.map(e=>({folderUri:b.parse(e.folderUri),remoteAuthority:e.remoteAuthority})))}catch{}return r}var fP=w(()=>{se()});function mP(o){return o?.hasOwnProperty("folderUri")}var hP=w(()=>{});import{createHash as My}from"crypto";function io(o){function r(){let e=o.scheme===N.file?ur(o):o.toString();return ne||(e=e.toLowerCase()),My("md5").update(e).digest("hex")}return{id:r(),configPath:o}}function Im(o,r){function e(){if(o.scheme!==N.file)return My("md5").update(o.toString()).digest("hex");if(!r)return;let n;return ne?n=r.ino:V?n=r.birthtime.getTime():M&&(typeof r.birthtimeMs=="number"?n=Math.floor(r.birthtimeMs):n=r.birthtime.getTime()),My("md5").update(o.fsPath).update(n?String(n):"").digest("hex")}let t=e();if(typeof t=="string")return{id:t,uri:o}}function vu(){return{id:(Date.now()+Math.round(Math.random()*1e3)).toString()}}var EB,bm=w(()=>{ze();Y();yt();EB=128/4});import{createHash as B2}from"crypto";var oo,gP=w(()=>{an();ze();Se();Y();yt();jt();fP();st();Ot();Jr();je();re();hP();hr();bm();oo=class{constructor(r,e,t,n){this.configurationService=e;this.logService=t;this.stateService=n;this.workspaces=[];this.folders=[];this.emptyWindows=[];this.backupUriComparer=Ge;this.backupPathComparer={isEqual:(r,e)=>Co(r,e,!ne)};this.backupHome=r.backupHome}static{this.backupWorkspacesMetadataStorageKey="backupWorkspaces"}async initialize(){let r=this.stateService.getItem(oo.backupWorkspacesMetadataStorageKey)??{workspaces:[],folders:[],emptyWindows:[]};this.emptyWindows=await this.validateEmptyWorkspaces(r.emptyWindows),this.workspaces=await this.validateWorkspaces(uP(r)),this.folders=await this.validateFolders(pP(r)),this.storeWorkspacesMetadata()}getWorkspaceBackups(){return this.isHotExitOnExitAndWindowClose()?[]:this.workspaces.slice(0)}getFolderBackups(){return this.isHotExitOnExitAndWindowClose()?[]:this.folders.slice(0)}isHotExitEnabled(){return this.getHotExitConfig()!==em.OFF}isHotExitOnExitAndWindowClose(){return this.getHotExitConfig()===em.ON_EXIT_AND_WINDOW_CLOSE}getHotExitConfig(){return this.configurationService.getValue()?.files?.hotExit||em.ON_EXIT}getEmptyWindowBackups(){return this.emptyWindows.slice(0)}registerWorkspaceBackup(r,e){this.workspaces.some(n=>r.workspace.id===n.workspace.id)||(this.workspaces.push(r),this.storeWorkspacesMetadata());let t=U(this.backupHome,r.workspace.id);return e?this.moveBackupFolder(t,e).then(()=>t):t}async moveBackupFolder(r,e){if(await q.exists(r)&&await this.convertToEmptyWindowBackup(r),await q.exists(e))try{await q.rename(e,r,!1)}catch(t){this.logService.error(`Backup: Could not move backup folder to new location: ${t.toString()}`)}}registerFolderBackup(r){return this.folders.some(e=>this.backupUriComparer.isEqual(r.folderUri,e.folderUri))||(this.folders.push(r),this.storeWorkspacesMetadata()),U(this.backupHome,this.getFolderHash(r))}registerEmptyWindowBackup(r){return this.emptyWindows.some(e=>!!e.backupFolder&&this.backupPathComparer.isEqual(e.backupFolder,r.backupFolder))||(this.emptyWindows.push(r),this.storeWorkspacesMetadata()),U(this.backupHome,r.backupFolder)}async validateWorkspaces(r){if(!Array.isArray(r))return[];let e=new Set,t=[];for(let n of r){let i=n.workspace;if(!it(i))return[];if(!e.has(i.id)){e.add(i.id);let s=U(this.backupHome,i.id);await this.doHasBackups(s)?i.configPath.scheme!==N.file||await q.exists(i.configPath.fsPath)?t.push(n):await this.convertToEmptyWindowBackup(s):await this.deleteStaleBackup(s)}}return t}async validateFolders(r){if(!Array.isArray(r))return[];let e=[],t=new Set;for(let n of r){let i=n.folderUri,s=this.backupUriComparer.getComparisonKey(i);if(!t.has(s)){t.add(s);let a=U(this.backupHome,this.getFolderHash(n));await this.doHasBackups(a)?i.scheme!==N.file||await q.exists(i.fsPath)?e.push(n):await this.convertToEmptyWindowBackup(a):await this.deleteStaleBackup(a)}}return e}async validateEmptyWorkspaces(r){if(!Array.isArray(r))return[];let e=[],t=new Set;for(let n of r){let i=n.backupFolder;if(typeof i!="string")return[];if(!t.has(i)){t.add(i);let s=U(this.backupHome,i);await this.doHasBackups(s)?e.push(n):await this.deleteStaleBackup(s)}}return e}async deleteStaleBackup(r){try{await q.rm(r,1)}catch(e){this.logService.error(`Backup: Could not delete stale backup: ${e.toString()}`)}}prepareNewEmptyWindowBackup(){let r=vu();for(;this.emptyWindows.some(e=>!!e.backupFolder&&this.backupPathComparer.isEqual(e.backupFolder,r.id));)r=vu();return{backupFolder:r.id}}async convertToEmptyWindowBackup(r){let e=this.prepareNewEmptyWindowBackup(),t=U(this.backupHome,e.backupFolder);try{await q.rename(r,t,!1)}catch(n){return this.logService.error(`Backup: Could not rename backup folder: ${n.toString()}`),!1}return this.emptyWindows.push(e),!0}async getDirtyWorkspaces(){let r=[];for(let e of this.workspaces)await this.hasBackups(e)&&r.push(e);for(let e of this.folders)await this.hasBackups(e)&&r.push(e);return r}hasBackups(r){let e;return dP(r)?e=U(this.backupHome,r.backupFolder):mP(r)?e=U(this.backupHome,this.getFolderHash(r)):e=U(this.backupHome,r.workspace.id),this.doHasBackups(e)}async doHasBackups(r){try{let e=await q.readdir(r);for(let t of e)try{if((await q.readdir(U(r,t))).length>0)return!0}catch{}}catch{}return!1}storeWorkspacesMetadata(){let r={workspaces:this.workspaces.map(({workspace:e,remoteAuthority:t})=>{let n={id:e.id,configURIPath:e.configPath.toString()};return t&&(n.remoteAuthority=t),n}),folders:this.folders.map(({folderUri:e,remoteAuthority:t})=>{let n={folderUri:e.toString()};return t&&(n.remoteAuthority=t),n}),emptyWindows:this.emptyWindows.map(({backupFolder:e,remoteAuthority:t})=>{let n={backupFolder:e};return t&&(n.remoteAuthority=t),n})};this.stateService.setItem(oo.backupWorkspacesMetadataStorageKey,r)}getFolderHash(r){let e=r.folderUri,t;return e.scheme===N.file?t=ne?e.fsPath:e.fsPath.toLowerCase():t=e.toString().toLowerCase(),B2("md5").update(t).digest("hex")}};oo=T([g(0,Te),g(1,ge),g(2,O),g(3,ft)],oo)});function yu(o,r,e=V2){let t=o.find((f,m)=>f.length>0&&f[0]!=="-"&&r.hasOwnProperty(f)&&r[f].type==="subcommand"),n={},i=["_"],s=[],a={},l;for(let f in r){let m=r[f];m.type==="subcommand"?f===t&&(l=m):(m.alias&&(n[f]=m.alias),m.type==="string"||m.type==="string[]"?(i.push(f),m.deprecates&&i.push(...m.deprecates)):m.type==="boolean"&&(s.push(f),m.deprecates&&s.push(...m.deprecates)),m.global&&(a[f]=m))}if(l&&t){let f=a;for(let S in l.options)f[S]=l.options[S];let m=o.filter(S=>S!==t),y=e.getSubcommandReporter?e.getSubcommandReporter(t):void 0,v=yu(m,f,y);return{[t]:v,_:[]}}let c=(0,vP.default)(o,{string:i,boolean:s,alias:n}),d={},u=c;d._=c._.map(f=>String(f)).filter(f=>f.length>0),delete u._;for(let f in r){let m=r[f];if(m.type==="subcommand")continue;m.alias&&delete u[m.alias];let y=u[f];if(m.deprecates)for(let v of m.deprecates)u.hasOwnProperty(v)&&(y||(y=u[v],y&&e.onDeprecatedOption(v,m.deprecationMessage||h(1897,null,f))),delete u[v]);if(typeof y<"u"){if(m.type==="string[]"){if(Array.isArray(y)||(y=[y]),!m.allowEmptyValue){let v=y.filter(S=>S.length>0);v.length!==y.length&&(e.onEmptyValue(f),y=v.length>0?v:void 0)}}else m.type==="string"&&(Array.isArray(y)?(y=y.pop(),e.onMultipleValues(f,y)):!y&&!m.allowEmptyValue&&(e.onEmptyValue(f),y=void 0));d[f]=y,m.deprecationMessage&&e.onDeprecatedOption(f,m.deprecationMessage)}delete u[f]}for(let f in u)e.onUnknownOption(f);return d}var vP,tV,Oy,Sm,V2,Fy=w(()=>{vP=Db(Kg(),1);Y();Ce();tV={o:h(1921,null),e:h(1906,null),t:h(1934,null),m:h(1917,null)},Oy=["tunnel","serve-web"],Sm={"serve-web":{type:"subcommand",description:"Run a server that displays the editor UI in browsers.",options:{"cli-data-dir":{type:"string",args:"dir",description:h(1896,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"}}},tunnel:{type:"subcommand",description:"Make the current machine accessible from vscode.dev or other machines through a secure tunnel.",options:{"cli-data-dir":{type:"string",args:"dir",description:h(1896,null)},"disable-telemetry":{type:"boolean"},"telemetry-level":{type:"string"},user:{type:"subcommand",options:{login:{type:"subcommand",options:{provider:{type:"string"},"access-token":{type:"string"}}}}}}},diff:{type:"boolean",cat:"o",alias:"d",args:["file","file"],description:h(1898,null)},merge:{type:"boolean",cat:"o",alias:"m",args:["path1","path2","base","result"],description:h(1918,null)},add:{type:"boolean",cat:"o",alias:"a",args:"folder",description:h(1893,null)},remove:{type:"boolean",cat:"o",args:"folder",description:h(1925,null)},goto:{type:"boolean",cat:"o",alias:"g",args:"file:line[:character]",description:h(1907,null)},"new-window":{type:"boolean",cat:"o",alias:"n",description:h(1919,null)},"reuse-window":{type:"boolean",cat:"o",alias:"r",description:h(1926,null)},sessions:{type:"boolean",cat:"o",description:h(1927,null)},wait:{type:"boolean",cat:"o",alias:"w",description:h(1944,null)},waitMarkerFilePath:{type:"string"},locale:{type:"string",cat:"o",args:"locale",description:h(1914,null)},"user-data-dir":{type:"string",cat:"o",args:"dir",description:h(1941,null)},profile:{type:"string",cat:"o",args:"profileName",description:h(1924,null)},help:{type:"boolean",cat:"o",alias:"h",description:h(1908,null)},"extensions-dir":{type:"string",deprecates:["extensionHomePath"],cat:"e",args:"dir",description:h(1905,null)},"extensions-download-dir":{type:"string"},"builtin-extensions-dir":{type:"string"},"list-extensions":{type:"boolean",cat:"e",description:h(1913,null)},"show-versions":{type:"boolean",cat:"e",description:h(1928,null)},category:{type:"string",allowEmptyValue:!0,cat:"e",description:h(1895,null),args:"category"},"install-extension":{type:"string[]",cat:"e",args:"ext-id | path",description:h(1912,null)},"pre-release":{type:"boolean",cat:"e",description:h(1911,null)},"uninstall-extension":{type:"string[]",cat:"e",args:"ext-id",description:h(1936,null)},"update-extensions":{type:"boolean",cat:"e",description:h(1939,null)},"enable-proposed-api":{type:"string[]",allowEmptyValue:!0,cat:"e",args:"ext-id",description:h(1904,null)},"add-mcp":{type:"string[]",cat:"m",args:"json",description:h(1894,null)},version:{type:"boolean",cat:"t",alias:"v",description:h(1943,null)},verbose:{type:"boolean",cat:"t",global:!0,description:h(1942,null)},log:{type:"string[]",cat:"t",args:"level",global:!0,description:h(1916,null)},status:{type:"boolean",alias:"s",cat:"t",description:h(1929,null)},"prof-startup":{type:"boolean",cat:"t",description:h(1923,null)},"prof-append-timers":{type:"string"},"prof-duration-markers":{type:"string[]"},"prof-duration-markers-file":{type:"string"},"no-cached-data":{type:"boolean"},"prof-startup-prefix":{type:"string"},"prof-v8-extensions":{type:"boolean"},"disable-extensions":{type:"boolean",deprecates:["disableExtensions"],cat:"t",description:h(1901,null)},"disable-extension":{type:"string[]",cat:"t",args:"ext-id",description:h(1900,null)},sync:{type:"string",cat:"t",description:h(1935,null),args:["on | off"]},"inspect-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugPluginHost"],args:"port",cat:"t",description:h(1910,null)},"inspect-brk-extensions":{type:"string",allowEmptyValue:!0,deprecates:["debugBrkPluginHost"],args:"port",cat:"t",description:h(1909,null)},"disable-lcd-text":{type:"boolean",cat:"t",description:h(1903,null)},"disable-gpu":{type:"boolean",cat:"t",description:h(1902,null)},"disable-chromium-sandbox":{type:"boolean",cat:"t",description:h(1899,null)},sandbox:{type:"boolean"},"locate-shell-integration-path":{type:"string",cat:"t",args:["shell"],description:h(1915,null)},telemetry:{type:"boolean",cat:"t",description:h(1932,null)},remote:{type:"string",allowEmptyValue:!0},"folder-uri":{type:"string[]",cat:"o",args:"uri"},"file-uri":{type:"string[]",cat:"o",args:"uri"},"locate-extension":{type:"string[]"},extensionDevelopmentPath:{type:"string[]"},extensionDevelopmentKind:{type:"string[]"},extensionTestsPath:{type:"string"},extensionEnvironment:{type:"string"},debugId:{type:"string"},debugRenderer:{type:"boolean"},"inspect-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-brk-ptyhost":{type:"string",allowEmptyValue:!0},"inspect-search":{type:"string",deprecates:["debugSearch"],allowEmptyValue:!0},"inspect-brk-search":{type:"string",deprecates:["debugBrkSearch"],allowEmptyValue:!0},"inspect-sharedprocess":{type:"string",allowEmptyValue:!0},"inspect-brk-sharedprocess":{type:"string",allowEmptyValue:!0},"export-default-configuration":{type:"string"},"export-policy-data":{type:"string",allowEmptyValue:!0},"install-source":{type:"string"},"enable-smoke-test-driver":{type:"boolean"},logExtensionHostCommunication:{type:"boolean"},"skip-release-notes":{type:"boolean"},"skip-welcome":{type:"boolean"},"disable-telemetry":{type:"boolean"},"disable-updates":{type:"boolean"},transient:{type:"boolean",cat:"t",description:h(1933,null)},"use-inmemory-secretstorage":{type:"boolean",deprecates:["disable-keytar"]},"password-store":{type:"string"},"disable-workspace-trust":{type:"boolean"},"disable-crash-reporter":{type:"boolean"},"crash-reporter-directory":{type:"string"},"crash-reporter-id":{type:"string"},"skip-add-to-recently-opened":{type:"boolean"},"open-url":{type:"boolean"},"file-write":{type:"boolean"},"file-chmod":{type:"boolean"},"install-builtin-extension":{type:"string[]"},force:{type:"boolean"},"do-not-sync":{type:"boolean"},"do-not-include-pack-dependencies":{type:"boolean"},trace:{type:"boolean"},"trace-memory-infra":{type:"boolean"},"trace-category-filter":{type:"string"},"trace-options":{type:"string"},"preserve-env":{type:"boolean"},"force-user-env":{type:"boolean"},"force-disable-user-env":{type:"boolean"},"open-devtools":{type:"boolean"},"disable-gpu-sandbox":{type:"boolean"},logsPath:{type:"string"},"__enable-file-policy":{type:"boolean"},editSessionId:{type:"string"},continueOn:{type:"string"},"enable-coi":{type:"boolean"},"unresponsive-sample-interval":{type:"string"},"unresponsive-sample-period":{type:"string"},"enable-rdp-display-tracking":{type:"boolean"},"disable-layout-restore":{type:"boolean"},"disable-experiments":{type:"boolean"},"no-proxy-server":{type:"boolean"},"no-sandbox":{type:"boolean",alias:"sandbox"},"proxy-server":{type:"string"},"proxy-bypass-list":{type:"string"},"proxy-pac-url":{type:"string"},"js-flags":{type:"string"},inspect:{type:"string",allowEmptyValue:!0},"inspect-brk":{type:"string",allowEmptyValue:!0},nolazy:{type:"boolean"},"force-device-scale-factor":{type:"string"},"force-renderer-accessibility":{type:"boolean"},"ignore-certificate-errors":{type:"boolean"},"allow-insecure-localhost":{type:"boolean"},"log-net-log":{type:"string"},vmodule:{type:"string"},_urls:{type:"string[]"},"disable-dev-shm-usage":{type:"boolean"},"profile-temp":{type:"boolean"},"ozone-platform":{type:"string"},"enable-tracing":{type:"string"},"trace-startup-format":{type:"string"},"trace-startup-file":{type:"string"},"trace-startup-duration":{type:"string"},"xdg-portal-required-version":{type:"string"},_:{type:"string[]"}},V2={onUnknownOption:()=>{},onMultipleValues:()=>{},onEmptyValue:()=>{},onDeprecatedOption:()=>{}}});var xm,yP=w(()=>{Q();K();xm=class extends C{constructor(){super(...arguments);this._onCloseEmitter=this._register(new x);this._onReloadEmitter=this._register(new x);this._onTerminateEmitter=this._register(new x);this._onAttachEmitter=this._register(new x)}static{this.ChannelName="extensionhostdebugservice"}call(e,t,n){switch(t){case"close":return Promise.resolve(this._onCloseEmitter.fire({sessionId:n[0]}));case"reload":return Promise.resolve(this._onReloadEmitter.fire({sessionId:n[0]}));case"terminate":return Promise.resolve(this._onTerminateEmitter.fire({sessionId:n[0]}));case"attach":return Promise.resolve(this._onAttachEmitter.fire({sessionId:n[0],port:n[1],subId:n[2]}))}throw new Error("Method not implemented.")}listen(e,t,n){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.")}}});var Pm,wP=w(()=>{nt();K();Mt();Za();Fy();Wt();yP();Pm=class extends xm{constructor(e){super();this.windowsMainService=e}call(e,t,n){return t==="openExtensionDevelopmentHostWindow"?this.openExtensionDevelopmentHostWindow(n[0],n[1]):t==="attachToCurrentWindowRenderer"?this.attachToCurrentWindowRenderer(n[0]):super.call(e,t,n)}async attachToCurrentWindowRenderer(e){let t=this.windowsMainService.getWindowById(e);return t?.win?this.openCdp(t.win,!0):{success:!1}}async openExtensionDevelopmentHostWindow(e,t){let n=yu(e,Sm);n.debugRenderer=t;let i=n.extensionDevelopmentPath;if(!i)return{success:!1};let[s]=await this.windowsMainService.openExtensionDevelopmentHostWindow(i,{context:5,cli:n,forceProfile:n.profile,forceTempProfile:n["profile-temp"]});if(!t)return{success:!0};let a=s.win;return a?this.openCdp(a,!1):{success:!0}}async openCdpServer(e,t){let{createServer:n}=await import("http"),i=n((d,u)=>{if(d.url==="/json/list"||d.url==="/json"){u.setHeader("Content-Type","application/json"),u.end(JSON.stringify([{description:"VS Code Renderer",devtoolsFrontendUrl:"",id:e,title:"VS Code Renderer",type:"page",url:"vscode://renderer",webSocketDebuggerUrl:c}]));return}else if(d.url==="/json/version"){u.setHeader("Content-Type","application/json"),u.end(JSON.stringify({Browser:"VS Code Renderer","Protocol-Version":"1.3",webSocketDebuggerUrl:c}));return}u.statusCode=404,u.end()});await new Promise(d=>i.listen(0,"127.0.0.1",d));let s=i.address(),a=typeof s=="object"&&s?s.port:0,c=`${typeof s=="string"?s:`ws://127.0.0.1:${s?.port}`}/${e}`;return i.on("upgrade",(d,u)=>{if(!d.url?.includes(e)){u.end();return}let f=Rf(d,u,{debugLabel:"extension-host-cdp-"+xe(),enableMessageSplitting:!1});f&&t(f)}),{server:i,wsUrl:c,port:a}}async openCdp(e,t){let n=e.webContents.debugger,i=n.isAttached()?1/0:0,s=xe(),a=t?`page-${s}`:void 0,{server:l,wsUrl:c,port:d}=await this.openCdpServer(s,u=>{i++===0&&n.attach();let f=new te;f.add(u);let m=S=>{f.isDisposed||u.write(H.fromString(JSON.stringify(S)))},y=(S,I,k,R)=>m({method:I,params:k,sessionId:R||a}),v=()=>{u.end(),f.dispose()};e.addListener("close",v),f.add(j(()=>e.removeListener("close",v))),n.addListener("message",y),f.add(j(()=>n.removeListener("message",y))),f.add(u.onData(S=>{let I;try{I=JSON.parse(S.toString())}catch(R){console.error("error reading cdp line",R);return}if(t){let R={targetId:s,type:"page",title:"VS Code Renderer",url:"vscode://renderer"};if(I.method==="Target.setDiscoverTargets"){m({id:I.id,sessionId:I.sessionId,result:{}}),m({method:"Target.targetCreated",sessionId:I.sessionId,params:{targetInfo:{...R,attached:!1,canAccessOpener:!1}}});return}if(I.method==="Target.attachToTarget"){m({id:I.id,sessionId:I.sessionId,result:{sessionId:a}}),m({method:"Target.attachedToTarget",params:{sessionId:a,targetInfo:{...R,attached:!0,canAccessOpener:!1},waitingForDebugger:!1}});return}if(I.method==="Target.setAutoAttach"||I.method==="Target.attachToBrowserTarget"){m({id:I.id,sessionId:I.sessionId,result:I.method==="Target.attachToBrowserTarget"?{sessionId:"browser"}:{}});return}if(I.method==="Target.getTargets"){m({id:I.id,sessionId:I.sessionId,result:{targetInfos:[{...R,attached:!0}]}});return}}let k=I.sessionId===a?void 0:I.sessionId;n.sendCommand(I.method,I.params,k).then(R=>m({id:I.id,sessionId:I.sessionId,result:R})).catch(R=>m({id:I.id,sessionId:I.sessionId,error:{code:0,message:R.message}}))})),f.add(u.onClose(()=>{--i===0&&n.detach()}))});return e.on("close",()=>l.close()),{rendererDebugAddr:c,success:!0,port:d}}}});function Iu(o){let r=o;return!!r?.hostName&&!!r?.errorMessage}var H2,wu,Em=w(()=>{Z();H2="diagnosticsService",wu=W(H2)});function Ny(o,r=!1){let e=0,t=o.length,n="",i=0,s=16,a=0;function l(v){let S=0,I=0;for(;S<v;){let k=o.charCodeAt(e);if(k>=48&&k<=57)I=I*16+k-48;else if(k>=65&&k<=70)I=I*16+k-65+10;else if(k>=97&&k<=102)I=I*16+k-97+10;else break;e++,S++}return S<v&&(I=-1),I}function c(v){e=v,n="",i=0,s=16,a=0}function d(){let v=e;if(o.charCodeAt(e)===48)e++;else for(e++;e<o.length&&xl(o.charCodeAt(e));)e++;if(e<o.length&&o.charCodeAt(e)===46)if(e++,e<o.length&&xl(o.charCodeAt(e)))for(e++;e<o.length&&xl(o.charCodeAt(e));)e++;else return a=3,o.substring(v,e);let S=e;if(e<o.length&&(o.charCodeAt(e)===69||o.charCodeAt(e)===101))if(e++,(e<o.length&&o.charCodeAt(e)===43||o.charCodeAt(e)===45)&&e++,e<o.length&&xl(o.charCodeAt(e))){for(e++;e<o.length&&xl(o.charCodeAt(e));)e++;S=e}else a=3;return o.substring(v,S)}function u(){let v="",S=e;for(;;){if(e>=t){v+=o.substring(S,e),a=2;break}let I=o.charCodeAt(e);if(I===34){v+=o.substring(S,e),e++;break}if(I===92){if(v+=o.substring(S,e),e++,e>=t){a=2;break}switch(o.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 R=l(4);R>=0?v+=String.fromCharCode(R):a=4;break}default:a=5}S=e;continue}if(I>=0&&I<=31)if(Tm(I)){v+=o.substring(S,e),a=2;break}else a=6;e++}return v}function f(){if(n="",a=0,i=e,e>=t)return i=t,s=17;let v=o.charCodeAt(e);if(Uy(v)){do e++,n+=String.fromCharCode(v),v=o.charCodeAt(e);while(Uy(v));return s=15}if(Tm(v))return e++,n+=String.fromCharCode(v),v===13&&o.charCodeAt(e)===10&&(e++,n+=`
`),s=14;switch(v){case 123:return e++,s=1;case 125:return e++,s=2;case 91:return e++,s=3;case 93:return e++,s=4;case 58:return e++,s=6;case 44:return e++,s=5;case 34:return e++,n=u(),s=10;case 47:{let S=e-1;if(o.charCodeAt(e+1)===47){for(e+=2;e<t&&!Tm(o.charCodeAt(e));)e++;return n=o.substring(S,e),s=12}if(o.charCodeAt(e+1)===42){e+=2;let I=t-1,k=!1;for(;e<I;){if(o.charCodeAt(e)===42&&o.charCodeAt(e+1)===47){e+=2,k=!0;break}e++}return k||(e++,a=1),n=o.substring(S,e),s=13}return n+=String.fromCharCode(v),e++,s=16}case 45:if(n+=String.fromCharCode(v),e++,e===t||!xl(o.charCodeAt(e)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return n+=d(),s=11;default:for(;e<t&&m(v);)e++,v=o.charCodeAt(e);if(i!==e){switch(n=o.substring(i,e),n){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return n+=String.fromCharCode(v),e++,s=16}}function m(v){if(Uy(v)||Tm(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 y(){let v;do v=f();while(v>=12&&v<=15);return v}return{setPosition:c,getPosition:()=>e,scan:r?y:f,getToken:()=>s,getTokenValue:()=>n,getTokenOffset:()=>i,getTokenLength:()=>e-i,getTokenError:()=>a}}function Uy(o){return o===32||o===9||o===11||o===12||o===160||o===5760||o>=8192&&o<=8203||o===8239||o===8287||o===12288||o===65279}function Tm(o){return o===10||o===13||o===8232||o===8233}function xl(o){return o>=48&&o<=57}function Rn(o,r=[],e=Cm.DEFAULT){let t=null,n=[],i=[];function s(l){Array.isArray(n)?n.push(l):t!==null&&(n[t]=l)}return Pl(o,{onObjectBegin:()=>{let l={};s(l),i.push(n),n=l,t=null},onObjectProperty:l=>{t=l},onObjectEnd:()=>{n=i.pop()},onArrayBegin:()=>{let l=[];s(l),i.push(n),n=l,t=null},onArrayEnd:()=>{n=i.pop()},onLiteralValue:s,onError:(l,c,d)=>{r.push({error:l,offset:c,length:d})}},e),n[0]}function IP(o,r=[],e=Cm.DEFAULT){let t={type:"array",offset:-1,length:-1,children:[],parent:void 0};function n(l){t.type==="property"&&(t.length=l-t.offset,t=t.parent)}function i(l){return t.children.push(l),l}Pl(o,{onObjectBegin:l=>{t=i({type:"object",offset:l,length:-1,parent:t,children:[]})},onObjectProperty:(l,c,d)=>{t=i({type:"property",offset:c,length:-1,parent:t,children:[]}),t.children.push({type:"string",value:l,offset:c,length:d,parent:t})},onObjectEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,n(l+c)},onArrayBegin:(l,c)=>{t=i({type:"array",offset:l,length:-1,parent:t,children:[]})},onArrayEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,n(l+c)},onLiteralValue:(l,c,d)=>{i({type:Go(l),offset:c,length:d,parent:t,value:l}),n(c+d)},onSeparator:(l,c,d)=>{t.type==="property"&&(l===":"?t.colonOffset=c:l===","&&n(c))},onError:(l,c,d)=>{r.push({error:l,offset:c,length:d})}},e);let a=t.children[0];return a&&delete a.parent,a}function By(o,r){if(!o)return;let e=o;for(let t of r)if(typeof t=="string"){if(e.type!=="object"||!Array.isArray(e.children))return;let n=!1;for(let i of e.children)if(Array.isArray(i.children)&&i.children[0].value===t){e=i.children[1],n=!0;break}if(!n)return}else{let n=t;if(e.type!=="array"||n<0||!Array.isArray(e.children)||n>=e.children.length)return;e=e.children[n]}return e}function Pl(o,r,e=Cm.DEFAULT){let t=Ny(o,!1);function n(z){return z?()=>z(t.getTokenOffset(),t.getTokenLength()):()=>!0}function i(z){return z?Pe=>z(Pe,t.getTokenOffset(),t.getTokenLength()):()=>!0}let s=n(r.onObjectBegin),a=i(r.onObjectProperty),l=n(r.onObjectEnd),c=n(r.onArrayBegin),d=n(r.onArrayEnd),u=i(r.onLiteralValue),f=i(r.onSeparator),m=n(r.onComment),y=i(r.onError),v=e&&e.disallowComments,S=e&&e.allowTrailingComma;function I(){for(;;){let z=t.scan();switch(t.getTokenError()){case 4:k(14);break;case 5:k(15);break;case 3:k(13);break;case 1:v||k(11);break;case 2:k(12);break;case 6:k(16);break}switch(z){case 12:case 13:v?k(10):m();break;case 16:k(1);break;case 15:case 14:break;default:return z}}}function k(z,Pe=[],Pt=[]){if(y(z),Pe.length+Pt.length>0){let Ft=t.getToken();for(;Ft!==17;){if(Pe.indexOf(Ft)!==-1){I();break}else if(Pt.indexOf(Ft)!==-1)break;Ft=I()}}}function R(z){let Pe=t.getTokenValue();return z?u(Pe):a(Pe),I(),!0}function D(){switch(t.getToken()){case 11:{let z=0;try{z=JSON.parse(t.getTokenValue()),typeof z!="number"&&(k(2),z=0)}catch{k(2)}u(z);break}case 7:u(null);break;case 8:u(!0);break;case 9:u(!1);break;default:return!1}return I(),!0}function F(){return t.getToken()!==10?(k(3,[],[2,5]),!1):(R(!1),t.getToken()===6?(f(":"),I(),ee()||k(4,[],[2,5])):k(5,[],[2,5]),!0)}function ce(){s(),I();let z=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(z||k(4,[],[]),f(","),I(),t.getToken()===2&&S)break}else z&&k(6,[],[]);F()||k(4,[],[2,5]),z=!0}return l(),t.getToken()!==2?k(7,[2],[]):I(),!0}function B(){c(),I();let z=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(z||k(4,[],[]),f(","),I(),t.getToken()===4&&S)break}else z&&k(6,[],[]);ee()||k(4,[],[4,5]),z=!0}return d(),t.getToken()!==4?k(8,[4],[]):I(),!0}function ee(){switch(t.getToken()){case 3:return B();case 1:return ce();case 10:return R(!0);default:return D()}}return I(),t.getToken()===17?e.allowEmptyContent?!0:(k(4,[],[]),!1):ee()?(t.getToken()!==17&&k(9,[],[]),!0):(k(4,[],[]),!1)}function Go(o){switch(typeof o){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(o){if(Array.isArray(o))return"array"}else return"null";return"object"}default:return"null"}}var Cm,Zn=w(()=>{(r=>r.DEFAULT={allowTrailingComma:!0})(Cm||={})});var _m,Oe,bu=w(()=>{dr();_m=(n=>(n[n.Ignore=0]="Ignore",n[n.Info=1]="Info",n[n.Warning=2]="Warning",n[n.Error=3]="Error",n))(_m||{});(a=>{let o="error",r="warning",e="warn",t="info",n="ignore";function i(l){return l?Hr(o,l)?3:Hr(r,l)||Hr(e,l)?2:Hr(t,l)?1:0:0}a.fromValue=i;function s(l){switch(l){case 3:return o;case 2:return r;case 1:return t;default:return n}}a.toString=s})(_m||={});Oe=_m});function gr(o){if(!o||typeof o!="object"||o instanceof RegExp)return o;let r=Array.isArray(o)?[]:{};return Object.entries(o).forEach(([e,t])=>{r[e]=t&&typeof t=="object"?gr(t):t}),r}function bP(o){if(!o||typeof o!="object")return o;let r=[o];for(;r.length>0;){let e=r.shift();Object.freeze(e);for(let t in e)if(SP.call(e,t)){let n=e[t];typeof n=="object"&&!Object.isFrozen(n)&&!TS(n)&&r.push(n)}}return o}function xP(o,r){return Hy(o,r,new Set)}function Hy(o,r,e){if(At(o))return o;let t=r(o);if(typeof t<"u")return t;if(Array.isArray(o)){let n=[];for(let i of o)n.push(Hy(i,r,e));return n}if(Je(o)){if(e.has(o))throw new Error("Cannot clone recursive data-structure");e.add(o);let n={};for(let i in o)SP.call(o,i)&&(n[i]=Hy(o[i],r,e));return e.delete(o),n}return o}function km(o,r,e=!0){return Je(o)?(Je(r)&&Object.keys(r).forEach(t=>{t in o?e&&(Je(o[t])&&Je(r[t])?km(o[t],r[t],e):o[t]=r[t]):o[t]=r[t]}),o):r}function cn(o,r){if(o===r)return!0;if(o==null||r===null||r===void 0||typeof o!=typeof r||typeof o!="object"||Array.isArray(o)!==Array.isArray(r))return!1;let e,t;if(Array.isArray(o)){if(o.length!==r.length)return!1;for(e=0;e<o.length;e++)if(!cn(o[e],r[e]))return!1}else{let n=[];for(t in o)n.push(t);n.sort();let i=[];for(t in r)i.push(t);if(i.sort(),!cn(n,i))return!1;for(e=0;e<n.length;e++)if(!cn(o[n[e]],r[n[e]]))return!1}return!0}function Ky(o){let r=new Set;return JSON.stringify(o,(e,t)=>{if(Je(t)||Array.isArray(t)){if(r.has(t))return"[Circular]";r.add(t)}return typeof t=="bigint"?`[BigInt ${t.toString()}]`:t})}function $y(o,r){let e=r.toLowerCase(),t=Object.keys(o).find(n=>n.toLowerCase()===e);return t?o[t]:o[r]}var SP,yn=w(()=>{We();SP=Object.prototype.hasOwnProperty});function Rm(o,r){let e=gr(o),t=(e.buttons??[]).map(a=>_d(a).withMnemonic),n=(o.buttons||[]).map((a,l)=>l),i=0,s=e.cancelId??t.length-1;if(t.length>1){let a=typeof s=="number"?t[s]:void 0;if(ne||V){if(typeof a=="string"&&t.length>1&&s!==1){t.splice(s,1),t.splice(1,0,a);let l=n[s];n.splice(s,1),n.splice(1,0,l),s=1}ne&&t.length>1&&(t=t.reverse(),n=n.reverse(),i=t.length-1,typeof a=="string"&&(s=i-1))}else if(M&&typeof a=="string"&&t.length>1&&s!==t.length-1){t.splice(s,1),t.push(a);let l=n[s];n.splice(s,1),n.push(l),s=t.length-1}}return e.buttons=t,e.defaultId=i,e.cancelId=s,e.noLink=!0,e.title=e.title||r.nameLong,{options:e,buttonIndeces:n}}var CV,_V,qy=w(()=>{yt();bu();Ce();Z();Ji();Y();yn();CV=W("dialogService"),_V=W("fileDialogService")});import Gs from"electron";var wn,El,js=w(()=>{he();yi();Ji();K();wd();Y();jt();Ce();qy();Z();re();Qt();hr();wn=W("dialogMainService"),El=class{constructor(r,e){this.logService=r;this.productService=e;this.windowFileDialogLocks=new Map;this.windowDialogQueues=new Map;this.noWindowDialogueQueue=new Cn}pickFileFolder(r,e){return this.doPick({...r,pickFolders:!0,pickFiles:!0,title:h(1886,null)},e)}pickFolder(r,e){let t={...r,pickFolders:!0,title:h(1888,null)};return M&&(t={...t,buttonLabel:_d(h(1891,null)).withMnemonic}),this.doPick(t,e)}pickFile(r,e){return this.doPick({...r,pickFiles:!0,title:h(1887,null)},e)}pickWorkspace(r,e){let t=h(1890,null),n=_d(h(1889,null)).withMnemonic,i=Gx;return this.doPick({...r,pickFiles:!0,title:t,filters:i,buttonLabel:n},e)}async doPick(r,e){let t={title:r.title,buttonLabel:r.buttonLabel,filters:r.filters,defaultPath:r.defaultPath};(typeof r.pickFiles=="boolean"||typeof r.pickFolders=="boolean")&&(t.properties=void 0,r.pickFiles&&r.pickFolders&&(t.properties=["multiSelections","openDirectory","openFile","createDirectory"])),t.properties||(t.properties=["multiSelections",r.pickFolders?"openDirectory":"openFile","createDirectory"]),V&&t.properties.push("treatPackageAsDirectory");let n=await this.showOpenDialog(t,(e||Gs.BrowserWindow.getFocusedWindow())??void 0);if(n?.filePaths&&n.filePaths.length>0)return n.filePaths}getWindowDialogQueue(r){if(r){let e=this.windowDialogQueues.get(r.id);return e||(e=new Cn,this.windowDialogQueues.set(r.id,e)),e}else return this.noWindowDialogueQueue}showMessageBox(r,e){return this.getWindowDialogQueue(e).queue(async()=>{let{options:t,buttonIndeces:n}=Rm(r,this.productService),i;return e?i=await Gs.dialog.showMessageBox(e,t):i=await Gs.dialog.showMessageBox(t),{response:n[i.response],checkboxChecked:i.checkboxChecked}})}async showSaveDialog(r,e){let t=this.acquireFileDialogLock(r,e);if(!t)return this.logService.error("[DialogMainService]: file save dialog is already or will be showing for the window with the same configuration"),{canceled:!0,filePath:""};try{return await this.getWindowDialogQueue(e).queue(async()=>{let n;return e?n=await Gs.dialog.showSaveDialog(e,r):n=await Gs.dialog.showSaveDialog(r),n.filePath=this.normalizePath(n.filePath),n})}finally{pt(t)}}normalizePath(r){return r&&V&&(r=hi(r)),r}normalizePaths(r){return r.map(e=>this.normalizePath(e))}async showOpenDialog(r,e){r.defaultPath&&(await q.exists(r.defaultPath)||(r.defaultPath=void 0));let t=this.acquireFileDialogLock(r,e);if(!t)return this.logService.error("[DialogMainService]: file open dialog is already or will be showing for the window with the same configuration"),{canceled:!0,filePaths:[]};try{return await this.getWindowDialogQueue(e).queue(async()=>{let n;return e?n=await Gs.dialog.showOpenDialog(e,r):n=await Gs.dialog.showOpenDialog(r),n.filePaths=this.normalizePaths(n.filePaths),n})}finally{pt(t)}}acquireFileDialogLock(r,e){if(!e)return C.None;this.logService.trace("[DialogMainService]: request to acquire file dialog lock",r);let t=this.windowFileDialogLocks.get(e.id);t||(t=new Set,this.windowFileDialogLocks.set(e.id,t));let n=rr(r);if(!t.has(n))return this.logService.trace("[DialogMainService]: new file dialog lock created",r),t.add(n),j(()=>{this.logService.trace("[DialogMainService]: file dialog lock disposed",r),t?.delete(n),t?.size===0&&this.windowFileDialogLocks.delete(e.id)})}};El=T([g(0,O),g(1,_e)],El)});async function EP(o,r,e){for(let n of o){let i=n.openedWorkspace;if(it(i)){let s=await e(i);if(s){if(s.folders.some(a=>Ge.isEqualOrParent(r,a.uri)))return n}else if(Ge.isEqualOrParent(r,i.configPath))return n}}let t=o.filter(n=>Rt(n.openedWorkspace)&&Ge.isEqualOrParent(r,n.openedWorkspace.uri));if(t.length)return t.sort((n,i)=>-(n.openedWorkspace.uri.path.length-i.openedWorkspace.uri.path.length))[0]}function _i(o,r){for(let e of o)if(it(e.openedWorkspace)&&Ge.isEqual(e.openedWorkspace.configPath,r)||Rt(e.openedWorkspace)&&Ge.isEqual(e.openedWorkspace.uri,r))return e}function TP(o,r){let e=t=>r.some(n=>Ge.isEqual(b.file(n),b.file(t)));for(let t of o)if(t.config?.extensionDevelopmentPath?.some(n=>e(n)))return t}var Dm=w(()=>{yt();se();hr()});function CP(o,r,e){let t,n,i,s,a;if(r){for(s=r.offset,a=s+r.length,i=s;i>0&&!Su(o,i-1);)i--;let R=a;for(;R<o.length&&!Su(o,R);)R++;n=o.substring(i,R),t=K2(n,e)}else n=o,t=0,i=0,s=0,a=o.length;let l=$2(e,o),c=!1,d=0,u;e.insertSpaces?u=zy(" ",e.tabSize||4):u="	";let f=Ny(n,!1),m=!1;function y(){return l+zy(u,t+d)}function v(){let R=f.scan();for(c=!1;R===15||R===14;)c=c||R===14,R=f.scan();return m=R===16||f.getTokenError()!==0,R}let S=[];function I(R,D,F){!m&&D<a&&F>s&&o.substring(D,F)!==R&&S.push({offset:D,length:F-D,content:R})}let k=v();if(k!==17){let R=f.getTokenOffset()+i,D=zy(u,t);I(D,i,R)}for(;k!==17;){let R=f.getTokenOffset()+f.getTokenLength()+i,D=v(),F="";for(;!c&&(D===12||D===13);){let B=f.getTokenOffset()+i;I(" ",R,B),R=f.getTokenOffset()+f.getTokenLength()+i,F=D===12?y():"",D=v()}if(D===2)k!==1&&(d--,F=y());else if(D===4)k!==3&&(d--,F=y());else{switch(k){case 3:case 1:d++,F=y();break;case 5:case 12:F=y();break;case 13:c?F=y():F=" ";break;case 6:F=" ";break;case 10:if(D===6){F="";break}case 7:case 8:case 9:case 11:case 2:case 4:D===12||D===13?F=" ":D!==5&&D!==17&&(m=!0);break;case 16:m=!0;break}c&&(D===12||D===13)&&(F=y())}let ce=f.getTokenOffset()+i;I(F,R,ce),k=D}return S}function zy(o,r){let e="";for(let t=0;t<r;t++)e+=o;return e}function K2(o,r){let e=0,t=0,n=r.tabSize||4;for(;e<o.length;){let i=o.charAt(e);if(i===" ")t++;else if(i==="	")t+=n;else break;e++}return Math.floor(t/n)}function $2(o,r){for(let e=0;e<r.length;e++){let t=r.charAt(e);if(t==="\r")return e+1<r.length&&r.charAt(e+1)===`
`?`\r
`:"\r";if(t===`
`)return`
`}return o&&o.eol||`
`}function Su(o,r){return`\r
`.indexOf(o.charAt(r))!==-1}var _P=w(()=>{Zn()});function jy(o,r,e,t,n){let i=r.slice(),a=IP(o,[]),l,c;for(;i.length>0&&(c=i.pop(),l=By(a,i),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 d=By(l,[c]);if(d!==void 0)if(e===void 0){if(!d.parent)throw new Error("Malformed AST");let u=l.children.indexOf(d.parent),f,m=d.parent.offset+d.parent.length;if(u>0){let y=l.children[u-1];f=y.offset+y.length}else f=l.offset+1,l.children.length>1&&(m=l.children[1].offset);return Tl(o,{offset:f,length:m-f,content:""},t)}else return Tl(o,{offset:d.offset,length:d.length,content:JSON.stringify(e)},t);else{if(e===void 0)return[];let u=`${JSON.stringify(c)}: ${JSON.stringify(e)}`,f=n?n(l.children.map(y=>y.children[0].value)):l.children.length,m;if(f>0){let y=l.children[f-1];m={offset:y.offset+y.length,length:0,content:","+u}}else l.children.length===0?m={offset:l.offset+1,length:0,content:u}:m={offset:l.offset+1,length:0,content:u+","};return Tl(o,m,t)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children))if(e!==void 0){let d=`${JSON.stringify(e)}`,u;if(l.children.length===0||c===0)u={offset:l.offset+1,length:0,content:l.children.length===0?d:d+","};else{let f=c===-1||c>l.children.length?l.children.length:c,m=l.children[f-1];u={offset:m.offset+m.length,length:0,content:","+d}}return Tl(o,u,t)}else{let d=c,u=l.children[d],f;if(l.children.length===1)f={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===d){let m=l.children[d-1],y=m.offset+m.length,v=l.offset+l.length;f={offset:y,length:v-2-y,content:""}}else f={offset:u.offset,length:l.children[d+1].offset-u.offset,content:""};return Tl(o,f,t)}else throw new Error(`Can not add ${typeof c!="number"?"index":"property"} to parent of type ${l.type}`);else return e===void 0?[]:Tl(o,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(e)},t)}function Tl(o,r,e){let t=Gy(o,r),n=r.offset,i=r.offset+r.content.length;if(r.length===0||r.content.length===0){for(;n>0&&!Su(t,n-1);)n--;for(;i<t.length&&!Su(t,i);)i++}let s=CP(t,{offset:n,length:i-n},e);for(let l=s.length-1;l>=0;l--){let c=s[l];t=Gy(t,c),n=Math.min(n,c.offset),i=Math.max(i,c.offset+c.length),i+=c.content.length-c.length}let a=o.length-(t.length-i)-n;return[{offset:n,length:a,content:t.substring(n,i)}]}function Gy(o,r){return o.substring(0,r.offset)+r.content+o.substring(r.offset+r.length)}function Jy(o,r){let e=r.slice(0).sort((n,i)=>{let s=n.offset-i.offset;return s===0?n.length-i.length:s}),t=o.length;for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.offset+i.length<=t)o=Gy(o,i);else throw new Error("Overlapping edit");t=i.offset}return o}var Qy=w(()=>{Zn();_P()});function so(o){return o.scheme===N.vscodeRemote?o.authority:void 0}var Cl=w(()=>{ze()});function Wm(o){return o.hasOwnProperty("workspace")}function xu(o){return o.hasOwnProperty("folderUri")}function RP(o){return o.hasOwnProperty("fileUri")}function DP(o){return WP(o)||LP(o)}function WP(o){let r=o;return typeof r?.path=="string"&&(!r.name||typeof r.name=="string")}function LP(o){let r=o;return typeof r?.uri=="string"&&(!r.name||typeof r.name=="string")}function AP(o,r,e,t,n){if(o.scheme!==t.scheme)return{name:e,uri:o.toString(!0)};let i=r?void 0:n.relativePath(t,o);if(i!==void 0)i.length===0?i=".":M&&(i=kP(i));else if(o.scheme===N.file)i=o.fsPath,M&&(i=kP(i));else if(n.isEqualAuthority(o.authority,t.authority))i=o.path;else return{name:e,uri:o.toString(!0)};return{name:e,path:i}}function kP(o){return o=Cd(o),jS(o)||(o=fi(o)),o}function MP(o,r,e){let t=[],n=new Set,i=e.dirname(r);for(let s of o){let a;if(WP(s))s.path&&(a=e.resolvePath(i,s.path));else if(LP(s))try{a=b.parse(s.uri),a.path[0]!==ue.sep&&(a=a.with({path:ue.sep+a.path}))}catch(l){console.warn(l)}if(a){let l=e.getComparisonKey(a);if(!n.has(l)){n.add(l);let c=s.name||e.basenameOrAuthority(a);t.push(new rm({uri:a,name:c,index:t.length},s))}}}return t}function z2(o){let r=o;return typeof r?.workspace=="object"&&typeof r.workspace.id=="string"&&typeof r.workspace.configPath=="string"}function G2(o){return typeof o?.folderUri=="string"}function j2(o){return typeof o?.fileUri=="string"}function OP(o,r){let e={workspaces:[],files:[]};if(o){let t=function(i,s){for(let a=0;a<i.length;a++)try{s(i[a],a)}catch(l){r.warn(`Error restoring recent entry ${JSON.stringify(i[a])}: ${l.toString()}. Skip entry.`)}},n=o;Array.isArray(n.entries)&&t(n.entries,i=>{let s=i.label,a=i.remoteAuthority;z2(i)?e.workspaces.push({label:s,remoteAuthority:a,workspace:{id:i.workspace.id,configPath:b.parse(i.workspace.configPath)}}):G2(i)?e.workspaces.push({label:s,remoteAuthority:a,folderUri:b.parse(i.folderUri)}):j2(i)&&e.files.push({label:s,remoteAuthority:a,fileUri:b.parse(i.fileUri)})})}return e}function FP(o){let r={entries:[]},e=(t,n)=>t&&t!==n.fsPath&&t!==n.path;for(let t of o.workspaces)xu(t)?r.entries.push({folderUri:t.folderUri.toString(),label:e(t.label,t.folderUri)?t.label:void 0,remoteAuthority:t.remoteAuthority}):r.entries.push({workspace:{id:t.workspace.id,configPath:t.workspace.configPath.toString()},label:e(t.label,t.workspace.configPath)?t.label:void 0,remoteAuthority:t.remoteAuthority});for(let t of o.files)r.entries.push({fileUri:t.fileUri.toString(),label:e(t.label,t.fileUri)?t.label:void 0,remoteAuthority:t.remoteAuthority});return r}var Xy,Lm=w(()=>{an();Zn();Qy();Ji();ze();Se();Y();yt();se();Z();Cl();hr();Xy=W("workspacesService")});import*as Yy from"fs";import J2 from"electron";var dn,_l,jo=w(()=>{Q();Zn();K();ze();Se();yt();jt();Ce();Sl();js();Ot();Z();re();qo();Dm();hr();Lm();bm();dn=W("workspacesManagementMainService"),_l=class extends C{constructor(e,t,n,i,s){super();this.environmentMainService=e;this.logService=t;this.userDataProfilesMainService=n;this.backupMainService=i;this.dialogMainService=s;this._onDidDeleteUntitledWorkspace=this._register(new x);this.onDidDeleteUntitledWorkspace=this._onDidDeleteUntitledWorkspace.event;this._onDidEnterWorkspace=this._register(new x);this.onDidEnterWorkspace=this._onDidEnterWorkspace.event;this.untitledWorkspaces=[];this.untitledWorkspacesHome=this.environmentMainService.untitledWorkspacesHome}async initialize(){this.untitledWorkspaces=[];try{let e=(await q.readdir(this.untitledWorkspacesHome.with({scheme:N.file}).fsPath)).map(t=>fe(this.untitledWorkspacesHome,t,Iy));for(let t of e){let n=io(t),i=await this.resolveLocalWorkspace(t);i?this.untitledWorkspaces.push({workspace:n,remoteAuthority:i.remoteAuthority}):await this.deleteUntitledWorkspace(n)}}catch(e){e.code!=="ENOENT"&&this.logService.warn(`Unable to read folders in ${this.untitledWorkspacesHome} (${e}).`)}}resolveLocalWorkspace(e){return this.doResolveLocalWorkspace(e,t=>Yy.promises.readFile(t,"utf8"))}doResolveLocalWorkspace(e,t){if(this.isWorkspacePath(e)&&e.scheme===N.file)try{let n=t(e.fsPath);return n instanceof Promise?n.then(i=>this.doResolveWorkspace(e,i),i=>{}):this.doResolveWorkspace(e,n)}catch{return}}isWorkspacePath(e){return by(e,this.environmentMainService)||bi(e)}doResolveWorkspace(e,t){try{let n=this.doParseStoredWorkspace(e,t),i=io(e);return{id:i.id,configPath:i.configPath,folders:MP(n.folders,i.configPath,Ge),remoteAuthority:n.remoteAuthority,transient:n.transient}}catch(n){this.logService.warn(n.toString())}}doParseStoredWorkspace(e,t){let n=Rn(t);if(n&&Array.isArray(n.folders))n.folders=n.folders.filter(i=>DP(i));else throw new Error(`${e.toString(!0)} looks like an invalid workspace file.`);return n}async createUntitledWorkspace(e,t){let{workspace:n,storedWorkspace:i}=this.newUntitledWorkspace(e,t),s=n.configPath.fsPath;return await Yy.promises.mkdir($e(s),{recursive:!0}),await q.writeFile(s,JSON.stringify(i,null,"	")),this.untitledWorkspaces.push({workspace:n,remoteAuthority:t}),n}newUntitledWorkspace(e=[],t){let n=(Date.now()+Math.round(Math.random()*1e3)).toString(),i=fe(this.untitledWorkspacesHome,n),s=fe(i,Iy),a=[];for(let l of e)a.push(AP(l.uri,!0,l.name,i,Ge));return{workspace:io(s),storedWorkspace:{folders:a,remoteAuthority:t}}}async getWorkspaceIdentifier(e){return io(e)}isUntitledWorkspace(e){return by(e.configPath,this.environmentMainService)}async deleteUntitledWorkspace(e){this.isUntitledWorkspace(e)&&(await this.doDeleteUntitledWorkspace(e),this.userDataProfilesMainService.unsetWorkspace(e),this._onDidDeleteUntitledWorkspace.fire(e))}async doDeleteUntitledWorkspace(e){let t=ur(e.configPath);try{await q.rm($e(t));let n=U(this.environmentMainService.workspaceStorageHome.with({scheme:N.file}).fsPath,e.id);await q.exists(n)&&await q.writeFile(U(n,"obsolete"),""),this.untitledWorkspaces=this.untitledWorkspaces.filter(i=>i.workspace.id!==e.id)}catch(n){this.logService.warn(`Unable to delete untitled workspace ${t} (${n}).`)}}getUntitledWorkspaces(){return this.untitledWorkspaces}async enterWorkspace(e,t,n){if(!e?.win||!e.isReady||!await this.isValidTargetWorkspacePath(e,t,n))return;let s=await this.doEnterWorkspace(e,io(n));if(s)return this._onDidEnterWorkspace.fire({window:e,workspace:s.workspace}),s}async isValidTargetWorkspacePath(e,t,n){return n?it(e.openedWorkspace)&&Ge.isEqual(e.openedWorkspace.configPath,n)?!1:_i(t,n)?(await this.dialogMainService.showMessageBox({type:"info",buttons:[h(2766,null)],message:h(2768,null,Kr(n)),detail:h(2767,null)},J2.BrowserWindow.getFocusedWindow()??void 0),!1):!0:!0}async doEnterWorkspace(e,t){if(!e.config)return;e.focus();let n;return e.config.extensionDevelopmentPath||(e.config.backupPath?n=await this.backupMainService.registerWorkspaceBackup({workspace:t,remoteAuthority:e.remoteAuthority},e.config.backupPath):n=this.backupMainService.registerWorkspaceBackup({workspace:t,remoteAuthority:e.remoteAuthority})),it(e.openedWorkspace)&&this.isUntitledWorkspace(e.openedWorkspace)&&await this.deleteUntitledWorkspace(e.openedWorkspace),e.config.workspace=t,e.config.backupPath=n,{workspace:t,backupPath:n}}};_l=T([g(0,Te),g(1,O),g(2,Or),g(3,Ci),g(4,wn)],_l)});function UP(o,...r){let e=r.reduce((i,s)=>(i[s]=!0,i),{}),t=[/^ELECTRON_.+$/,/^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,/^SNAP(|_.*)$/,/^GDK_PIXBUF_.+$/];Object.keys(o).filter(i=>!e[i]).forEach(i=>{for(let s=0;s<t.length;s++)if(i.search(t[s])!==-1){delete o[i];break}})}function Am(o){o&&(delete o.DEBUG,ne&&delete o.LD_PRELOAD)}var Pu=w(()=>{Y()});import{MessageChannelMain as Q2,app as X2,utilityProcess as Y2}from"electron";import{StringDecoder as NP}from"string_decoder";function Z2(o){return typeof o.responseWindowId=="number"}var or,Jo,Js=w(()=>{K();Q();re();he();ze();Wt();bu();ir();xt();Pu();yn();Y();Va();or=class extends C{constructor(e,t,n){super();this.logService=e;this.telemetryService=t;this.lifecycleMainService=n;this.id=String(++or.ID_COUNTER);this._onStdout=this._register(new x);this.onStdout=this._onStdout.event;this._onStderr=this._register(new x);this.onStderr=this._onStderr.event;this._onMessage=this._register(new x);this.onMessage=this._onMessage.event;this._onSpawn=this._register(new x);this.onSpawn=this._onSpawn.event;this._onExit=this._register(new x);this.onExit=this._onExit.event;this._onCrash=this._register(new x);this.onCrash=this._onCrash.event;this.process=void 0;this.processPid=void 0;this.configuration=void 0}static{this.ID_COUNTER=0}static{this.all=new Map}static getAll(){return Array.from(or.all.values())}log(e,t){let n;switch(this.configuration?.correlationId?n=`[UtilityProcess id: ${this.configuration?.correlationId}, type: ${this.configuration?.type}, pid: ${this.processPid??"<none>"}]: ${e}`:n=`[UtilityProcess type: ${this.configuration?.type}, pid: ${this.processPid??"<none>"}]: ${e}`,t){case Oe.Error:this.logService.error(n);break;case Oe.Warning:this.logService.warn(n);break;case Oe.Info:this.logService.trace(n);break}}interpretExitCode(e){switch(e){case 0:return"Normal exit";case 1:return"General error";case 6:return"SIGABRT - Process aborted (likely memory corruption or assertion failure)";case 9:return"SIGKILL - Process killed (likely OOM killer)";case 11:return"SIGSEGV - Segmentation fault (memory access violation)";case 134:return"SIGABRT with core dump - Process aborted with core dump";case 137:return"SIGKILL with core dump - Process killed with core dump";case 139:return"SIGSEGV with core dump - Segmentation fault with core dump";default:return`Unknown exit code (${e})`}}logUtilityProcessCrash(e,t){let n=new Date().toISOString(),i=this.interpretExitCode(e);if(this.logService.error("=== UTILITY PROCESS CRASH REPORT ==="),this.logService.error(`Time: ${n}`),this.logService.error(`PID: ${this.processPid??"<none>"}, Exit Code: ${e} (${i}), Reason: ${t}`),this.logService.error(`Process Type: ${this.configuration?.type??"<unknown>"}`),this.logService.error(`Process ID: ${this.configuration?.correlationId??"<none>"}`),this.logService.error(`Entry Point: ${this.configuration?.entryPoint??"<unknown>"}`),typeof process<"u"&&process.memoryUsage)try{let a=process.memoryUsage();this.logService.error(`Main Process Memory: RSS=${Math.round(a.rss/1024/1024)}MB, Heap=${Math.round(a.heapUsed/1024/1024)}MB, External=${Math.round(a.external/1024/1024)}MB`)}catch(a){this.logService.error(`Could not retrieve memory information: ${a}`)}if(this.configuration?.args&&this.configuration.args.length>0&&this.logService.error(`Process Args: ${this.configuration.args.join(" ")}`),this.configuration?.env){let l=["NODE_ENV","ELECTRON_ENABLE_LOGGING","ELECTRON_RUN_AS_NODE"].filter(c=>this.configuration.env[c]).map(c=>`${c}=${this.configuration.env[c]}`).join(", ");l&&this.logService.error(`Relevant Environment: ${l}`)}this.logService.error("System Information:"),this.logService.error(`  - Node Version: ${process.version}`),this.logService.error(`  - Platform: ${process.platform}_${process.arch}`),this.logService.error(`  - Electron Version: ${process.versions.electron??"unknown"}`);let s=or.getAll();s.length>0&&(this.logService.error(`Active Utility Processes: ${s.length} processes`),this.logService.error("Sample Processes:"),s.slice(0,5).forEach(a=>{this.logService.error(`  - ${a.name} (PID: ${a.pid})`)})),this.logService.error("=== END UTILITY PROCESS CRASH REPORT ===")}validateCanStart(){return this.process?(this.log("Cannot start utility process because it is already running...",Oe.Error),!1):!0}start(e){let t=this.doStart(e);return t&&e.payload&&this.postMessage(e.payload)&&this.log("payload sent via postMessage()",Oe.Info),t}doStart(e){if(!this.validateCanStart())return!1;this.configuration=e;let t=`${this.configuration.type}-${this.id}`,n=et.asFileUri("bootstrap-fork.js").fsPath,i=this.configuration.args??[],s=this.configuration.execArgv??[],a=this.configuration.allowLoadingUnsignedLibraries,l=this.configuration.respondToAuthRequestsFromMainProcess,c="pipe",d=this.createEnv(e);return this.log("creating new...",Oe.Info),this.process=Y2.fork(n,i,{serviceName:t,env:d,execArgv:s,allowLoadingUnsignedLibraries:a,respondToAuthRequestsFromMainProcess:l,stdio:c}),this.registerListeners(this.process,this.configuration,t),!0}createEnv(e){let t=e.env?{...e.env}:{...gr(process.env)};t.VSCODE_ESM_ENTRYPOINT=e.entryPoint,typeof e.parentLifecycleBound=="number"&&(t.VSCODE_PARENT_PID=String(e.parentLifecycleBound)),t.VSCODE_CRASH_REPORTER_PROCESS_TYPE=e.type,M&&(C1()?t.NODE_DISABLE_UNC_ACCESS_CHECKS="1":t.NODE_UNC_HOST_ALLOWLIST=P1().join("\\")),Am(t);for(let n of Object.keys(t))t[n]=String(t[n]);return t}registerListeners(e,t,n){if(e.stdout){let i=new NP("utf-8");this._register(E.fromNodeEventEmitter(e.stdout,"data")(s=>this._onStdout.fire(typeof s=="string"?s:i.write(s))))}if(e.stderr){let i=new NP("utf-8");this._register(E.fromNodeEventEmitter(e.stderr,"data")(s=>this._onStderr.fire(typeof s=="string"?s:i.write(s))))}this._register(E.fromNodeEventEmitter(e,"message")(i=>this._onMessage.fire(i))),this._register(E.fromNodeEventEmitter(e,"spawn")(()=>{this.processPid=e.pid,typeof e.pid=="number"&&or.all.set(e.pid,{pid:e.pid,name:Z2(t)?`${t.name} [${t.responseWindowId}]`:t.name}),this.log("successfully created",Oe.Info),this._onSpawn.fire(e.pid)})),this._register(E.fromNodeEventEmitter(e,"exit")(i=>{this.log(`received exit event with code ${i}`,Oe.Info),this._onExit.fire({pid:this.processPid,code:i,signal:"unknown"}),this.onDidExitOrCrashOrKill()})),this._register(E.fromNodeEventEmitter(X2,"child-process-gone",(i,s)=>({event:i,details:s}))(({details:i})=>{i.type==="Utility"&&i.name===n&&(this.log(`crashed with code ${i.exitCode} and reason '${i.reason}'`,Oe.Error),this.logUtilityProcessCrash(i.exitCode,i.reason),this.telemetryService.publicLog2("utilityprocesscrash",{type:t.type,reason:i.reason,code:i.exitCode}),this._onCrash.fire({pid:this.processPid,code:i.exitCode,reason:i.reason}),this.onDidExitOrCrashOrKill())}))}once(e,t){let n=this._register(this._onMessage.event(i=>{i===e&&(n.dispose(),t())}))}postMessage(e,t){return this.process?(this.process.postMessage(e,t),!0):!1}connect(e){let{port1:t,port2:n}=new Q2;return this.postMessage(e,[n]),t}enableInspectPort(){if(!this.process||typeof this.processPid!="number")return!1;this.log("enabling inspect port",Oe.Info);let e=process;return typeof e._debugProcess=="function"?(e._debugProcess(this.processPid),!0):!1}kill(){if(!this.process)return;this.log("attempting to kill the process...",Oe.Info),this.process.kill()?(this.log("successfully killed the process",Oe.Info),this.onDidExitOrCrashOrKill()):this.log("unable to kill the process",Oe.Warning)}onDidExitOrCrashOrKill(){typeof this.processPid=="number"&&or.all.delete(this.processPid),this.process=void 0}async waitForExit(e){this.process&&(this.log("waiting to exit...",Oe.Info),await Promise.race([E.toPromise(this.onExit),lt(e)]),this.process&&(this.log(`did not exit within ${e}ms, will kill it now...`,Oe.Info),this.kill()))}};or=T([g(0,O),g(1,ot),g(2,me)],or);Jo=class extends or{constructor(e,t,n,i){super(e,n,i);this.windowsMainService=t}start(e){let t=this.windowsMainService.getWindowById(e.responseWindowId);if(!t?.win||t.win.isDestroyed()||t.win.webContents.isDestroyed())return this.log("Refusing to start utility process because requesting window cannot be found or is destroyed...",Oe.Error),!0;if(!super.doStart(e))return!1;this.registerWindowListeners(t.win,e);let i=this.connect(e.payload);return t.win.webContents.postMessage(e.responseChannel,e.responseNonce,[i]),!0}registerWindowListeners(e,t){if(t.windowLifecycleBound){let n=t.windowLifecycleGraceTime,i=n&&n>0?()=>this.waitForExit(n):()=>this.kill();this._register(E.filter(this.lifecycleMainService.onWillLoadWindow,s=>s.window.win===e)(i)),this._register(E.fromNodeEventEmitter(e,"closed")(i))}}};Jo=T([g(0,O),g(1,Le),g(2,ot),g(3,me)],Jo)});import{app as Zy}from"electron";var eW,Rl,kl,ew=w(()=>{Qn();St();Z();Wt();hr();jo();We();re();Js();eW="diagnosticsMainService",Rl=W(eW),kl=class{constructor(r,e,t){this.windowsMainService=r;this.workspacesManagementMainService=e;this.logService=t}async getRemoteDiagnostics(r){let e=this.windowsMainService.getWindows();return(await Promise.all(e.map(async n=>{let i=n.remoteAuthority;if(!i)return;let s=`vscode:getDiagnosticInfoResponse${n.id}`,a={includeProcesses:r.includeProcesses,folders:r.includeWorkspaceMetadata?await this.getFolderURIs(n):void 0};return new Promise(l=>{n.sendWhenReady("vscode:getDiagnosticInfo",be.None,{replyChannel:s,args:a}),ct.once(s,(c,d)=>{d||l({hostName:i,errorMessage:`Unable to resolve connection to '${i}'.`}),l(d)}),setTimeout(()=>{l({hostName:i,errorMessage:`Connection to '${i}' could not be established`})},5e3)})}))).filter(n=>!!n)}async getMainDiagnostics(){this.logService.trace("Received request for main process info from other instance.");let r=[];for(let i of Ei()){let s=this.windowsMainService.getWindowById(i.id);s?r.push(await this.codeWindowToInfo(s)):r.push(this.browserWindowToInfo(i))}let e=[];for(let{pid:i,name:s}of or.getAll())e.push({pid:i,name:s});let t=[],n=Zy;return typeof n.getGPULogMessages=="function"&&(t=n.getGPULogMessages()),{mainPID:process.pid,mainArguments:process.argv.slice(1),windows:r,pidToNames:e,screenReader:!!Zy.accessibilitySupportEnabled,gpuFeatureStatus:Zy.getGPUFeatureStatus(),gpuLogMessages:t}}async codeWindowToInfo(r){let e=await this.getFolderURIs(r),t=ui(r.win);return this.browserWindowToInfo(t,e,r.remoteAuthority)}browserWindowToInfo(r,e=[],t){return{id:r.id,pid:r.webContents.getOSProcessId(),title:r.getTitle(),folderURIs:e,remoteAuthority:t}}async getFolderURIs(r){let e=[],t=r.openedWorkspace;if(Rt(t))e.push(t.uri);else if(it(t)){let n=await this.workspacesManagementMainService.resolveLocalWorkspace(t.configPath);n&&n.folders.forEach(s=>{e.push(s.uri)})}return e}};kl=T([g(0,Le),g(1,dn),g(2,O)],kl)});import{safeStorage as tW,app as rW}from"electron";var Qo,Dl,BP=w(()=>{Y();Of();re();Qo=tW,Dl=class{constructor(r){this.logService=r;rW.commandLine.getSwitchValue("password-store")==="basic"&&(this.logService.trace("[EncryptionMainService] setting usePlainTextEncryption to true..."),Qo.setUsePlainTextEncryption?.(!0),this.logService.trace("[EncryptionMainService] set usePlainTextEncryption to true"))}async encrypt(r){this.logService.trace("[EncryptionMainService] Encrypting value...");try{let e=JSON.stringify(Qo.encryptString(r));return this.logService.trace("[EncryptionMainService] Encrypted value."),e}catch(e){throw this.logService.error(e),e}}async decrypt(r){let e;try{if(e=JSON.parse(r),!e.data)throw new Error(`[EncryptionMainService] Invalid encrypted value: ${r}`);let t=Buffer.from(e.data);this.logService.trace("[EncryptionMainService] Decrypting value...");let n=Qo.decryptString(t);return this.logService.trace("[EncryptionMainService] Decrypted value."),n}catch(t){throw this.logService.error(t),t}}isEncryptionAvailable(){this.logService.trace("[EncryptionMainService] Checking if encryption is available...");let r=Qo.isEncryptionAvailable();return this.logService.trace("[EncryptionMainService] Encryption is available: ",r),Promise.resolve(r)}getKeyStorageProvider(){if(M)return Promise.resolve("dpapi");if(V)return Promise.resolve("keychain_access");if(Qo.getSelectedStorageBackend)try{this.logService.trace("[EncryptionMainService] Getting selected storage backend...");let r=Qo.getSelectedStorageBackend();return this.logService.trace("[EncryptionMainService] Selected storage backend: ",r),Promise.resolve(r)}catch(r){this.logService.error(r)}return Promise.resolve("unknown")}async setUsePlainTextEncryption(){if(M)throw new Error("Setting plain text encryption is not supported on Windows.");if(V)throw new Error("Setting plain text encryption is not supported on macOS.");if(!Qo.setUsePlainTextEncryption)throw new Error("Setting plain text encryption is not supported.");this.logService.trace("[EncryptionMainService] Setting usePlainTextEncryption to true..."),Qo.setUsePlainTextEncryption(!0),this.logService.trace("[EncryptionMainService] Set usePlainTextEncryption to true")}};Dl=T([g(0,O)],Dl)});var In,Qs=w(()=>{Z();In=W("auxiliaryWindowsMainService")});var tw,VP,Mm=w(()=>{tw="browserView",VP=999});function lW(o){return o===5||o===4||o===6||o===57}var Eu,Om,rw,nw,ow,nW,sw,iW,oW,sW,HP,iw,aW,KP=w(()=>{Eu=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(r,e){this._keyCodeToStr[r]=e,this._strToKeyCode[e.toLowerCase()]=r}keyCodeToStr(r){return this._keyCodeToStr[r]}strToKeyCode(r){return this._strToKeyCode[r.toLowerCase()]||0}},Om=new Eu,rw=new Eu,nw=new Eu,ow=new Array(230),nW={},sw={},iW=[],oW=Object.create(null),sW=Object.create(null),HP=[],iw=[];for(let o=0;o<=193;o++)HP[o]=-1;for(let o=0;o<=132;o++)iw[o]=-1;(function(){let r=[[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 n of r){let[i,s,a,l,c,d,u,f,m]=n;if(t[s]||(t[s]=!0,iW[s]=a,oW[a]=s,sW[a.toLowerCase()]=s,i&&(HP[s]=l,l!==0&&l!==3&&!lW(l)&&(iw[l]=s))),!e[l]){if(e[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${a}`);Om.define(l,c),rw.define(l,f||c),nw.define(l,m||f||c)}d&&(ow[d]=l),a&&(sw[a]=d),u&&(nW[u]=l)}iw[3]=46})();(s=>{function o(a){return Om.keyCodeToStr(a)}s.toString=o;function r(a){return Om.strToKeyCode(a)}s.fromString=r;function e(a){return rw.keyCodeToStr(a)}s.toUserSettingsUS=e;function t(a){return nw.keyCodeToStr(a)}s.toUserSettingsGeneral=t;function n(a){return rw.strToKeyCode(a)||nw.strToKeyCode(a)}s.fromUserSettings=n;function i(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right";case 20:return"Delete"}return Om.keyCodeToStr(a)}s.toElectronAccelerator=i})(aW||={})});var Tu,aw=w(()=>{ze();se();Mt();(i=>{i.scheme=N.vscodeBrowser;function r(s,a){let l=a??xe();return b.from({scheme:i.scheme,path:`/${l}`,query:s?`url=${encodeURIComponent(s)}`:void 0})}i.forUrl=r;function e(s){if(s.scheme!==i.scheme)return;let a=s.path.startsWith("/")?s.path.substring(1):s.path;if(!a)return;let l=s.query?new URLSearchParams(s.query).get("url")??"":"";return{id:a,url:l}}i.parse=e;function t(s){return e(s)?.id}i.getId=t;function n(s){return e(s)?.url}i.getUrl=n})(Tu||={})});var Fm,lw,$P=w(()=>{Q();K();Fm=class extends C{constructor(e,t){super();this.view=e;this.logService=t;this._sessions=this._register(new cr);this._electronDebugger=e.webContents.debugger,this._messageHandler=(n,i,s,a)=>{this.routeCDPEvent(i,s,a)}}async attach(){await this.initialize();let t=(await this._electronDebugger.sendCommand("Target.attachToTarget",{targetId:this._realTargetId,flatten:!0})).sessionId,n=new lw(t,this.view,this._electronDebugger);return this._sessions.set(t,n),n.onClose(()=>this._sessions.deleteAndDispose(t)),n}async getTargetInfo(){await this.initialize();let e=this.view.webContents.getURL()||"about:blank",t=this.view.webContents.getTitle()||e;return{targetId:this._realTargetId,type:"page",title:t,url:e,attached:this._sessions.size>0,canAccessOpener:!1,browserContextId:this.view.session.id}}initialize(){return this._initializePromise||(this._initializePromise=(async()=>{if(this.attachElectronDebugger(),await this.discoverRealTargetId(),!this._realTargetId)throw this._initializePromise=void 0,new Error("Could not discover real targetId for this WebContents")})()),this._initializePromise}async discoverRealTargetId(){try{let e=await this._electronDebugger.sendCommand("Target.getTargetInfo");this._realTargetId=e.targetInfo.targetId}catch(e){this.logService.error("[BrowserViewDebugger] Error discovering real targetId:",e)}}attachElectronDebugger(){this._electronDebugger.isAttached()||(this._electronDebugger.attach("1.3"),this._electronDebugger.on("message",this._messageHandler))}routeCDPEvent(e,t,n){if(!n)return;let i=this._sessions.get(n);i&&i.emitEvent({method:e,params:t,sessionId:n})}detachElectronDebugger(){if(this._electronDebugger.isAttached()){this._electronDebugger.removeListener("message",this._messageHandler);try{this._electronDebugger.detach()}catch(e){this.logService.error("[BrowserViewDebugger] Error detaching from WebContents:",e)}}}dispose(){this.detachElectronDebugger(),super.dispose()}},lw=class extends C{constructor(e,t,n){super();this.sessionId=e;this._view=t;this._electronDebugger=n;this._onEvent=this._register(new x);this.onEvent=this._onEvent.event;this.emitEvent=e=>this._onEvent.fire(e);this._onClose=this._register(new x);this.onClose=this._onClose.event;this._isDisposed=!1}async sendMessage(e,t,n){if(e==="Emulation.setDeviceMetricsOverride")return Promise.resolve({});let i=await this._electronDebugger.sendCommand(e,t,this.sessionId);return e==="Page.handleJavaScriptDialog"&&this._view.webContents.emit("-cancel-dialogs"),i}dispose(){this._isDisposed||(this._isDisposed=!0,this._electronDebugger.sendCommand("Target.detachFromTarget",{sessionId:this.sessionId}).catch(()=>{}),this._onClose.fire(),super.dispose())}}});import{WebContentsView as cW,webContents as dW}from"electron";var uW,Dn,cw=w(()=>{ze();K();Q();nt();Mm();KP();Wt();Qs();Y();aw();$P();re();uW=new Set([2079,2081,2100,3124,2102,...V?[]:[2103],2104,3128]),Dn=class extends C{constructor(e,t,n,i,s,a,l){super();this.id=e;this.session=t;this.windowsMainService=s;this.auxiliaryWindowsMainService=a;this.logService=l;this._faviconRequestCache=new Map;this._lastScreenshot=void 0;this._lastFavicon=void 0;this._lastError=void 0;this._lastUserGestureTimestamp=-1/0;this._isSendingKeyEvent=!1;this._isDisposed=!1;this._onDidNavigate=this._register(new x);this.onDidNavigate=this._onDidNavigate.event;this._onDidChangeLoadingState=this._register(new x);this.onDidChangeLoadingState=this._onDidChangeLoadingState.event;this._onDidChangeFocus=this._register(new x);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidChangeVisibility=this._register(new x);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidChangeDevToolsState=this._register(new x);this.onDidChangeDevToolsState=this._onDidChangeDevToolsState.event;this._onDidKeyCommand=this._register(new x);this.onDidKeyCommand=this._onDidKeyCommand.event;this._onDidChangeTitle=this._register(new x);this.onDidChangeTitle=this._onDidChangeTitle.event;this._onDidChangeFavicon=this._register(new x);this.onDidChangeFavicon=this._onDidChangeFavicon.event;this._onDidRequestNewPage=this._register(new x);this.onDidRequestNewPage=this._onDidRequestNewPage.event;this._onDidFindInPage=this._register(new x);this.onDidFindInPage=this._onDidFindInPage.event;this._onDidContextMenu=this._register(new x);this.onDidContextMenu=this._onDidContextMenu.event;this._onDidClose=this._register(new x);this.onDidClose=this._onDidClose.event;let c={...i?.webPreferences,nodeIntegration:!1,contextIsolation:!0,sandbox:!0,webviewTag:!1,session:this.session.electronSession,preload:et.asFileUri("vs/platform/browserView/electron-browser/preload-browserView.js").fsPath,type:"browserView"};this._view=new cW({webPreferences:c,...i?.webContents?{webContents:i.webContents}:{}}),this._view.setBackgroundColor("#FFFFFF"),this._view.webContents.setWindowOpenHandler(d=>{let u=(()=>{switch(d.disposition){case"background-tab":return"background";case"foreground-tab":return"foreground";case"new-window":return"newWindow";default:return}})();return!u||!this.consumePopupPermission(u)?{action:"deny"}:{action:"allow",createWindow:f=>{let m=n(f),y=Tu.forUrl(d.url,m.id);return this._onDidRequestNewPage.fire({resource:y,location:u,position:{x:f.x,y:f.y,width:f.width,height:f.height}}),m.webContents}}}),this._view.webContents.on("destroyed",()=>{this.dispose()}),this._debugger=new Fm(this,this.logService),this._register(t.acquire()),this.setupEventListeners()}setupEventListeners(){let e=this._view.webContents;e.on("devtools-opened",()=>{this._onDidChangeDevToolsState.fire({isDevToolsOpen:!0})}),e.on("devtools-closed",()=>{this._onDidChangeDevToolsState.fire({isDevToolsOpen:!1})}),e.on("page-favicon-updated",async(i,s)=>{for(let a of s){this._faviconRequestCache.has(a)||this._faviconRequestCache.set(a,(async()=>{let l=await e.session.fetch(a,{cache:"force-cache"});if(!l.ok)throw new Error(`Failed to fetch favicon: ${l.status} ${l.statusText}`);let c=await l.headers.get("content-type"),d=await l.arrayBuffer();return`data:${c};base64,${Buffer.from(d).toString("base64")}`})());try{this._lastFavicon=await this._faviconRequestCache.get(a),this._onDidChangeFavicon.fire({favicon:this._lastFavicon});return}catch{}}this._lastFavicon&&(this._lastFavicon=void 0,this._onDidChangeFavicon.fire({favicon:this._lastFavicon}))}),e.on("page-title-updated",(i,s)=>{this._onDidChangeTitle.fire({title:s})});let t=()=>{this._onDidNavigate.fire({url:e.getURL(),title:e.getTitle(),canGoBack:e.navigationHistory.canGoBack(),canGoForward:e.navigationHistory.canGoForward()})},n=i=>{this._onDidChangeLoadingState.fire({loading:i,error:this._lastError})};e.on("did-start-loading",()=>{this._lastError=void 0,n(!0)}),e.on("did-stop-loading",()=>n(!1)),e.on("did-fail-load",(i,s,a,l,c)=>{if(c){if(s===-3){n(!1);return}this._lastError={url:l,errorCode:s,errorDescription:a},n(!1),this._onDidNavigate.fire({url:l,title:"",canGoBack:e.navigationHistory.canGoBack(),canGoForward:e.navigationHistory.canGoForward()})}}),e.on("did-finish-load",()=>n(!1)),e.on("render-process-gone",(i,s)=>{this._lastError={url:e.getURL(),errorCode:s.exitCode,errorDescription:`Render process gone: ${s.reason}`},n(!1)}),e.on("did-navigate",t),e.on("did-navigate-in-page",t),e.on("focus",()=>{this._onDidChangeFocus.fire({focused:!0})}),e.on("blur",()=>{this._onDidChangeFocus.fire({focused:!1})}),e.on("before-input-event",async(i,s)=>{s.type==="keyDown"&&!this._isSendingKeyEvent&&this.tryHandleCommand(s)&&i.preventDefault()}),e.on("input-event",(i,s)=>{switch(s.type){case"rawKeyDown":case"keyDown":case"mouseDown":case"pointerDown":case"pointerUp":case"touchEnd":this._lastUserGestureTimestamp=Date.now()}}),e.on("will-prevent-unload",i=>{i.preventDefault()}),e.on("found-in-page",(i,s)=>{this._onDidFindInPage.fire({activeMatchOrdinal:s.activeMatchOrdinal,matches:s.matches,selectionArea:s.selectionArea,finalUpdate:s.finalUpdate})}),e.on("context-menu",(i,s)=>{this._onDidContextMenu.fire({x:s.x,y:s.y,selectionText:s.selectionText,linkURL:s.linkURL})})}consumePopupPermission(e){switch(e){case"foreground":case"background":return!0;case"newWindow":return this._lastUserGestureTimestamp>Date.now()-1e3?(this._lastUserGestureTimestamp=-1/0,!0):!1}}get webContents(){return this._view.webContents}getState(){let e=this._view.webContents;return{url:e.getURL(),title:e.getTitle(),canGoBack:e.navigationHistory.canGoBack(),canGoForward:e.navigationHistory.canGoForward(),loading:e.isLoading(),focused:e.isFocused(),visible:this._view.getVisible(),isDevToolsOpen:e.isDevToolsOpened(),lastScreenshot:this._lastScreenshot,lastFavicon:this._lastFavicon,lastError:this._lastError,storageScope:this.session.storageScope}}toggleDevTools(){this._view.webContents.toggleDevTools()}layout(e){if(this._window?.win?.id!==e.windowId){let t=this.windowById(e.windowId);t&&(this._window?.win?.contentView.removeChildView(this._view),this._window=t,t.win?.contentView.addChildView(this._view))}this._view.webContents.setZoomFactor(e.zoomFactor),this._view.setBounds({x:Math.round(e.x*e.zoomFactor),y:Math.round(e.y*e.zoomFactor),width:Math.round(e.width*e.zoomFactor),height:Math.round(e.height*e.zoomFactor)})}setVisible(e){this._view.getVisible()!==e&&(!e&&this._view.webContents.isFocused()&&this._window?.win?.webContents.focus(),this._view.setVisible(e),this._onDidChangeVisibility.fire({visible:e}))}async loadURL(e){await this._view.webContents.loadURL(e)}getURL(){return this._view.webContents.getURL()}goBack(){this._view.webContents.navigationHistory.canGoBack()&&this._view.webContents.navigationHistory.goBack()}goForward(){this._view.webContents.navigationHistory.canGoForward()&&this._view.webContents.navigationHistory.goForward()}reload(){this._view.webContents.reload()}canGoBack(){return this._view.webContents.navigationHistory.canGoBack()}canGoForward(){return this._view.webContents.navigationHistory.canGoForward()}async captureScreenshot(e){let t=await this._view.webContents.capturePage(e?.rect,{stayHidden:!0,stayAwake:!0}),n=e?.format==="png"?t.toPNG():t.toJPEG(e?.quality??80),i=H.wrap(n);return e?.rect||(this._lastScreenshot=i),i}async dispatchKeyEvent(e){let t={type:"keyDown",keyCode:e.key,modifiers:[]};e.ctrlKey&&t.modifiers.push("control"),e.shiftKey&&t.modifiers.push("shift"),e.altKey&&t.modifiers.push("alt"),e.metaKey&&t.modifiers.push("meta"),this._isSendingKeyEvent=!0;try{await this._view.webContents.sendInputEvent(t)}finally{this._isSendingKeyEvent=!1}}async setZoomFactor(e){await this._view.webContents.setZoomFactor(e)}async focus(){this._view.webContents.focus()}async findInPage(e,t){this._view.webContents.findInPage(e,{matchCase:t?.matchCase??!1,forward:t?.forward??!0,findNext:t?.recompute??!1})}async stopFindInPage(e){this._view.webContents.stopFindInPage(e?"keepSelection":"clearSelection")}async getSelectedText(){if(this._view.webContents.isLoading())return"";try{return await this._view.webContents.executeJavaScriptInIsolatedWorld(VP,[{code:'window.browserViewAPI?.getSelectedText?.() ?? ""'}])}catch{return""}}async clearStorage(){await this.session.electronSession.clearData()}allowClipboardWrite(){let e=this._view.webContents.id;this.session.allowClipboardWrite(e),this._register(j(()=>{this.session.disallowClipboardWrite(e)}))}configureRequestHeaders(e,t){let n=this._view.webContents.id;this._view.webContents.session.webRequest.onBeforeSendHeaders({urls:t},(i,s)=>{if(i.webContentsId===n)for(let[a,l]of Object.entries(e))i.requestHeaders[a]=l;s({requestHeaders:i.requestHeaders})})}getWebContentsView(){return this._view}getTargetInfo(){return this._debugger.getTargetInfo()}attach(){return this._debugger.attach()}dispose(){this._isDisposed||(this._isDisposed=!0,this._debugger.dispose(),this._window?.win?.contentView.removeChildView(this._view),this._onDidClose.fire(),this._view.webContents.close({waitForBeforeUnload:!1}),super.dispose())}tryHandleCommand(e){let t=sw[e.code]||0,n=ow[t]||0,i=n>=15&&n<=18,s=n===9||n>=59&&n<=82||n>=117;if(e.alt&&!e.control&&!e.meta&&!s&&!i||!(e.control||e.alt||e.meta)&&!s)return!1;let c=V?e.meta:e.control,d=n|(c?2048:0)|(e.shift?1024:0)|(e.alt?512:0);return uW.has(d)?!1:(this._onDidKeyCommand.fire({key:e.key,keyCode:t,code:e.code,ctrlKey:e.control||!1,shiftKey:e.shift||!1,altKey:e.alt||!1,metaKey:e.meta||!1,repeat:e.isAutoRepeat||!1}),!0)}windowById(e){return this.codeWindowById(e)??this.auxiliaryWindowById(e)}codeWindowById(e){if(typeof e=="number")return this.windowsMainService.getWindowById(e)}auxiliaryWindowById(e){if(typeof e!="number")return;let t=dW.fromId(e);if(t)return this.auxiliaryWindowsMainService.getWindowByWebContents(t)}};Dn=T([g(4,Le),g(5,In),g(6,O)],Dn)});import{session as dw}from"electron";var qP,Wn,zP=w(()=>{K();yt();Mm();qP=new Set(["pointerLock"]),Wn=class o extends C{constructor(e,t,n){super();this.id=e;this.electronSession=t;this.storageScope=n;this.refs=0;this._clipboardWriteAllowed=new Set;if(o._sessions.has(e))throw new Error(`BrowserSession with id '${e}' already exists`);this.configureSession(),o.knownSessions.add(t),o._sessions.set(e,this)}static{this._sessions=new Map}static{this.knownSessions=new WeakSet}static isBrowserViewWebContents(e){return o.knownSessions.has(e.session)}static get(e){return o._sessions.get(e)}static getBrowserContextIds(){return[...o._sessions.keys()]}static getOrCreateGlobal(){let e=o._sessions.get("global");return e||new o("global",dw.fromPartition("persist:vscode-browser"),"global")}static getOrCreateWorkspace(e,t){let n=`workspace:${e}`,i=o._sessions.get(n);if(i)return i;let s=fe(t,e,"browserStorage");return new o(n,dw.fromPath(s.fsPath),"workspace")}static getOrCreateEphemeral(e,t){if(t==="workspace"||t==="ephemeral")throw new Error(`Cannot create session with reserved type '${t}'`);let n=`${t??"ephemeral"}:${e}`,i=o._sessions.get(n);return i||new o(n,dw.fromPartition(`vscode-browser-${t}${e}`),"ephemeral")}static getOrCreate(e,t,n,i){switch(t){case"global":return o.getOrCreateGlobal();case"workspace":if(i)return o.getOrCreateWorkspace(i,n);case"ephemeral":default:return o.getOrCreateEphemeral(e)}}configureSession(){this.electronSession.setPermissionRequestHandler((e,t,n)=>qP.has(t)||t==="clipboard-sanitized-write"&&e&&this._clipboardWriteAllowed.has(e.id)?n(!0):n(!1)),this.electronSession.setPermissionCheckHandler((e,t,n)=>!!(qP.has(t)||t==="clipboard-sanitized-write"&&e&&this._clipboardWriteAllowed.has(e.id)))}allowClipboardWrite(e){this._clipboardWriteAllowed.add(e)}disallowClipboardWrite(e){this._clipboardWriteAllowed.delete(e)}acquire(){return this.refs++,j(()=>{this.refs--,this.refs===0&&this.dispose()})}dispose(){if(this.refs>0)throw new Error("Cannot dispose BrowserSession because it is still in use");o._sessions.delete(this.id),super.dispose()}}});var _u,ao,Um,Cu,Xo,uw=w(()=>{_u={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,ServerError:-32e3},ao=class extends Error{constructor(e,t){super(e);this.code=t;this.name="CDPError"}},Um=class extends ao{constructor(r){super(`Method not found: ${r}`,_u.MethodNotFound),this.name="CDPMethodNotFoundError"}},Cu=class extends ao{constructor(r){super(r,_u.InvalidParams),this.name="CDPInvalidParamsError"}},Xo=class extends ao{constructor(r){super(r,_u.ServerError),this.name="CDPServerError"}}});var Yo,pw,Nm=w(()=>{K();Q();Mt();uw();Yo=class extends C{constructor(e){super();this.browserTarget=e;this.sessionId=`browser-session-${xe()}`;this._isAttachedToBrowserTarget=!1;this._autoAttach=!1;this._discover=!1;this._targets=this._register(new pw);this._sessions=this._register(new cr);this._sessionTargetIds=new WeakMap;this._autoAttachments=new WeakMap;this._handlers=new Map([["Browser.addPrivacySandboxCoordinatorKeyConfig",()=>({})],["Browser.addPrivacySandboxEnrollmentOverride",()=>({})],["Browser.close",()=>({})],["Browser.getVersion",()=>this.browserTarget.getVersion()],["Browser.resetPermissions",()=>({})],["Browser.getWindowForTarget",(e,t)=>this.handleBrowserGetWindowForTarget(e,t)],["Browser.setDownloadBehavior",()=>({})],["Browser.setWindowBounds",()=>({})],["Target.activateTarget",e=>this.handleTargetActivateTarget(e)],["Target.attachToTarget",e=>this.handleTargetAttachToTarget(e)],["Target.closeTarget",e=>this.handleTargetCloseTarget(e)],["Target.createBrowserContext",()=>this.handleTargetCreateBrowserContext()],["Target.createTarget",e=>this.handleTargetCreateTarget(e)],["Target.detachFromTarget",e=>this.handleTargetDetachFromTarget(e)],["Target.disposeBrowserContext",e=>this.handleTargetDisposeBrowserContext(e)],["Target.getBrowserContexts",()=>this.handleTargetGetBrowserContexts()],["Target.getTargets",()=>this.handleTargetGetTargets()],["Target.setAutoAttach",e=>this.handleTargetSetAutoAttach(e)],["Target.setDiscoverTargets",e=>this.handleTargetSetDiscoverTargets(e)],["Target.attachToBrowserTarget",()=>this.handleTargetAttachToBrowserTarget()],["Target.getTargetInfo",e=>this.handleTargetGetTargetInfo(e)]]);this._onEvent=this._register(new x);this.onEvent=this._onEvent.event;this._onClose=this._register(new x);this.onClose=this._onClose.event;this._targets.onDidRegisterTarget(async({targetInfo:t})=>{this._discover&&this.sendBrowserEvent("Target.targetCreated",{targetInfo:t}),this._autoAttach&&await this.attachToTarget(t.targetId,!0)}),this._targets.onDidUnregisterTarget(({targetInfo:t})=>{let n=[];for(let[,i]of this._sessions)this._sessionTargetIds.get(i)===t.targetId&&n.push(i);for(let i of n)i.dispose();this._discover&&this.sendBrowserEvent("Target.targetDestroyed",{targetId:t.targetId})}),this._register(this.browserTarget.onTargetCreated(t=>this._targets.register(t))),this._register(this.browserTarget.onTargetDestroyed(t=>this._targets.unregister(t)));for(let t of this.browserTarget.getTargets())this._targets.register(t)}async sendMessage(e,t={},n){try{if(!n||n===this.sessionId||e.startsWith("Browser.")||e.startsWith("Target.")){let a=this._handlers.get(e);if(!a)throw new Um(e);return await a(t,n)}let i=this._sessions.get(n);if(!i)throw new Xo(`Session not found: ${n}`);return await i.sendMessage(e,t)??{}}catch(i){throw i instanceof ao?i:new Xo(i instanceof Error?i.message:"Unknown error")}}handleBrowserGetWindowForTarget({targetId:e},t){let n=(t&&this.findTargetIdForSession(t))??e;if(!n)throw new Xo("Unable to resolve target");let i=this._targets.getById(n);return this.browserTarget.getWindowForTarget(i)}handleTargetGetBrowserContexts(){return{browserContextIds:this.browserTarget.getBrowserContexts()}}async handleTargetCreateBrowserContext(){return{browserContextId:await this.browserTarget.createBrowserContext()}}async handleTargetDisposeBrowserContext({browserContextId:e}){return await this.browserTarget.disposeBrowserContext(e),{}}handleTargetAttachToBrowserTarget(){return this._isAttachedToBrowserTarget=!0,{sessionId:this.sessionId}}handleTargetActivateTarget({targetId:e}){let t=this._targets.getById(e);return this.browserTarget.activateTarget(t)}async handleTargetSetAutoAttach({autoAttach:e=!1,flatten:t}){if(!t)throw new Cu("This implementation only supports auto-attach with flatten=true");return this._autoAttach=e,{}}async handleTargetSetDiscoverTargets({discover:e=!1}){if(e!==this._discover&&(this._discover=e,this._discover))for(let t of this._targets.getAllInfos())this.sendBrowserEvent("Target.targetCreated",{targetInfo:t});return{}}async handleTargetGetTargets(){return{targetInfos:this._targets.getAllInfos()}}async handleTargetGetTargetInfo({targetId:e}={}){return e?{targetInfo:await this._targets.getById(e).getTargetInfo()}:{targetInfo:await this.browserTarget.getTargetInfo()}}async handleTargetAttachToTarget({targetId:e,flatten:t}){if(!t)throw new Cu("This implementation only supports attachToTarget with flatten=true");return{sessionId:(await this.attachToTarget(e,!1)).sessionId}}async handleTargetDetachFromTarget({sessionId:e}){let t=this._sessions.get(e);if(!t)throw new Xo(`Session not found: ${e}`);return t.dispose(),{}}async handleTargetCreateTarget({url:e,browserContextId:t}){let n=await this.browserTarget.createTarget(e||"about:blank",t),i=await this._targets.register(n);return this._autoAttach&&await this.attachToTarget(i.targetId,!0),{targetId:i.targetId}}async handleTargetCloseTarget({targetId:e}){try{return await this.browserTarget.closeTarget(this._targets.getById(e)),{success:!0}}catch{return{success:!1}}}findTargetIdForSession(e){let t=this._sessions.get(e);if(t)return this._sessionTargetIds.get(t)}sendBrowserEvent(e,t){let n=this._isAttachedToBrowserTarget?this.sessionId:void 0;this._onEvent.fire({method:e,params:t,sessionId:n})}async attachToTarget(e,t){let n=this._targets.getById(e);if(t&&this._autoAttachments.has(n))return this._autoAttachments.get(n);let i=(async()=>{let s=await n.attach(),a=s.sessionId;this._sessions.set(a,s),this._sessionTargetIds.set(s,e);let l=await n.getTargetInfo();return s.onEvent(c=>{c.method.startsWith("Target.")||this._onEvent.fire({method:c.method,params:c.params,sessionId:a})}),s.onClose(()=>{this.sendBrowserEvent("Target.detachedFromTarget",{sessionId:a,targetId:e}),this._sessions.deleteAndDispose(a),this._sessionTargetIds.delete(s),this._autoAttachments.get(n)===i&&this._autoAttachments.delete(n)}),this.sendBrowserEvent("Target.attachedToTarget",{sessionId:a,targetInfo:{...l,attached:!0},waitingForDebugger:!1}),s})();return t&&this._autoAttachments.set(n,i),i}},pw=class extends C{constructor(){super(...arguments);this._knownTargets=new WeakSet;this._targetInfos=new WeakMap;this._targetsByID=new Map;this._onDidRegisterTarget=this._register(new x);this.onDidRegisterTarget=this._onDidRegisterTarget.event;this._onDidUnregisterTarget=this._register(new x);this.onDidUnregisterTarget=this._onDidUnregisterTarget.event}getById(e){let t=this._targetsByID.get(e);if(!t)throw new Xo(`Unknown targetId: ${e}`);return t}*getAllInfos(){for(let e of this._targetsByID.values())yield this._targetInfos.get(e)}async register(e){if(this._knownTargets.has(e))return e.getTargetInfo();this._knownTargets.add(e);let t=await e.getTargetInfo();return this._knownTargets.has(e)&&(this._targetInfos.set(e,t),this._targetsByID.set(t.targetId,e),this._onDidRegisterTarget.fire({target:e,targetInfo:t})),t}async unregister(e){if(!this._knownTargets.has(e))return;this._knownTargets.delete(e);let t=this._targetInfos.get(e);t&&(this._targetInfos.delete(e),this._targetsByID.delete(t.targetId),this._onDidUnregisterTarget.fire({target:e,targetInfo:t}))}}});function GP(o,r){o.publicLog2("integratedBrowser.open",{source:r})}var jP=w(()=>{});var Ys,Xs,Bm=w(()=>{Q();K();Ot();Z();cw();Mt();aw();Wt();zP();Qt();Nm();jP();ir();Ys=W("browserViewMainService"),Xs=class extends C{constructor(e,t,n,i,s){super();this.environmentMainService=e;this.instantiationService=t;this.windowsMainService=n;this.productService=i;this.telemetryService=s;this.browserViews=this._register(new cr);this._onTargetCreated=this._register(new x);this.onTargetCreated=this._onTargetCreated.event;this._onTargetDestroyed=this._register(new x);this.onTargetDestroyed=this._onTargetDestroyed.event}static isBrowserViewWebContents(e){return Wn.isBrowserViewWebContents(e)}createBrowserView(e,t,n){if(this.browserViews.has(e))throw new Error(`Browser view with id ${e} already exists`);let i=this.instantiationService.createInstance(Dn,e,t,s=>this.createBrowserView(xe(),t,s),n);return this.browserViews.set(e,i),this._onTargetCreated.fire(i),E.once(i.onDidClose)(()=>{this._onTargetDestroyed.fire(i),this.browserViews.deleteAndDispose(e)}),i}async getOrCreateBrowserView(e,t,n){if(this.browserViews.has(e))return this.browserViews.get(e).getState();let i=Wn.getOrCreate(e,t,this.environmentMainService.workspaceStorageHome,n);return this.createBrowserView(e,i).getState()}tryGetBrowserView(e){return this.browserViews.get(e)}getVersion(){return{protocolVersion:"1.3",product:`${this.productService.nameShort}/${this.productService.version}`,revision:this.productService.commit||"unknown",userAgent:"Electron",jsVersion:process.versions.v8}}getWindowForTarget(e){if(!(e instanceof Dn))throw new Error("Can only get window for targets created by this service");let n=e.getWebContentsView().getBounds();return{windowId:1,bounds:{left:n.x,top:n.y,width:n.width,height:n.height,windowState:"normal"}}}async attach(){return new Yo(this)}async getTargetInfo(){return{targetId:"browser",type:"browser",title:this.getVersion().product,url:"",attached:!0,canAccessOpener:!1}}getTargets(){return this.browserViews.values()}async createTarget(e,t){let n=xe(),i=t&&Wn.get(t)||Wn.getOrCreateEphemeral(n),s=this.createBrowserView(n,i);return GP(this.telemetryService,"cdpCreated"),this.windowsMainService.sendToFocused("vscode:runAction",{id:"vscode.open",args:[Tu.forUrl(e,n)]}),s}async activateTarget(e){if(!(e instanceof Dn))throw new Error("Can only activate targets created by this service")}async closeTarget(e){if(!(e instanceof Dn))throw new Error("Can only close targets created by this service");return await this.destroyBrowserView(e.id),!0}getBrowserContexts(){return Wn.getBrowserContextIds()}async createBrowserContext(){return Wn.getOrCreateEphemeral(xe(),"cdp-created").id}async disposeBrowserContext(e){if(!e.startsWith("cdp-created:"))throw new Error("Can only dispose browser contexts created via CDP");let t=Wn.get(e);if(!t)throw new Error(`Browser context ${e} not found`);for(let n of this.browserViews.values())n.session===t&&await this.destroyBrowserView(n.id);t.dispose()}_getBrowserView(e){let t=this.browserViews.get(e);if(!t)throw new Error(`Browser view ${e} not found`);return t}onDynamicDidNavigate(e){return this._getBrowserView(e).onDidNavigate}onDynamicDidChangeLoadingState(e){return this._getBrowserView(e).onDidChangeLoadingState}onDynamicDidChangeFocus(e){return this._getBrowserView(e).onDidChangeFocus}onDynamicDidChangeVisibility(e){return this._getBrowserView(e).onDidChangeVisibility}onDynamicDidChangeDevToolsState(e){return this._getBrowserView(e).onDidChangeDevToolsState}onDynamicDidKeyCommand(e){return this._getBrowserView(e).onDidKeyCommand}onDynamicDidChangeTitle(e){return this._getBrowserView(e).onDidChangeTitle}onDynamicDidChangeFavicon(e){return this._getBrowserView(e).onDidChangeFavicon}onDynamicDidRequestNewPage(e){return this._getBrowserView(e).onDidRequestNewPage}onDynamicDidFindInPage(e){return this._getBrowserView(e).onDidFindInPage}onDynamicDidContextMenu(e){return this._getBrowserView(e).onDidContextMenu}onDynamicDidClose(e){return this._getBrowserView(e).onDidClose}async destroyBrowserView(e){return this.browserViews.deleteAndDispose(e)}async layout(e,t){return this._getBrowserView(e).layout(t)}async setVisible(e,t){return this._getBrowserView(e).setVisible(t)}async loadURL(e,t){return this._getBrowserView(e).loadURL(t)}async getURL(e){return this._getBrowserView(e).getURL()}async goBack(e){return this._getBrowserView(e).goBack()}async goForward(e){return this._getBrowserView(e).goForward()}async reload(e){return this._getBrowserView(e).reload()}async toggleDevTools(e){return this._getBrowserView(e).toggleDevTools()}async canGoBack(e){return this._getBrowserView(e).canGoBack()}async canGoForward(e){return this._getBrowserView(e).canGoForward()}async captureScreenshot(e,t){return this._getBrowserView(e).captureScreenshot(t)}async dispatchKeyEvent(e,t){return this._getBrowserView(e).dispatchKeyEvent(t)}async setZoomFactor(e,t){return this._getBrowserView(e).setZoomFactor(t)}async focus(e){return this._getBrowserView(e).focus()}async findInPage(e,t,n){return this._getBrowserView(e).findInPage(t,n)}async stopFindInPage(e,t){return this._getBrowserView(e).stopFindInPage(t)}async getSelectedText(e){return this._getBrowserView(e).getSelectedText()}async clearStorage(e){return this._getBrowserView(e).clearStorage()}async configureRequestHeaders(e,t,n){this._getBrowserView(e).configureRequestHeaders(t,n)}async allowClipboardWrite(e){this._getBrowserView(e).allowClipboardWrite()}async clearGlobalStorage(){await Wn.getOrCreateGlobal().electronSession.clearData()}async clearWorkspaceStorage(e){await Wn.getOrCreateWorkspace(e,this.environmentMainService.workspaceStorageHome).electronSession.clearData()}};Xs=T([g(0,Te),g(1,Vt),g(2,Le),g(3,_e),g(4,ot)],Xs)});import{webContents as Vm}from"electron";function QP(o){return o.browserViewId??o.webviewId}var fw,JP,ku,Wl,XP=w(()=>{Qs();Wt();Z();K();Bm();fw=W("browserElementsMainService"),JP=1e3,ku=new Map;Wl=class extends C{constructor(e,t,n){super();this.windowsMainService=e;this.auxiliaryWindowsMainService=t;this.browserViewMainService=n}get windowId(){throw new Error("Not implemented in electron-main")}async getConsoleLogs(e,t){let n=QP(t);if(!n)return;let i=ku.get(n);if(!(!i||i.length===0))return i.join(`
`)}async startConsoleSession(e,t,n,i){let s=this.windowById(e);if(!s?.win)return;let a=s.win.webContents,l;if(n.browserViewId&&(l=this.browserViewMainService.tryGetBrowserView(n.browserViewId)?.webContents),!l)return;let c=QP(n);if(!c)return;ku.has(c)||ku.set(c,[]);let d={0:"log",1:"warning",2:"error"},u=(v,S,I,k,R)=>{let F=`[${d[S]??"log"}] ${I}`,ce=ku.get(c)??[];ce.push(F),ce.length>JP&&ce.splice(0,ce.length-JP),ku.set(c,ce)},f=()=>{l?.off("console-message",u),l?.off("destroyed",y),a.off("ipc-message",m)},m=(v,S,I)=>{if(S===`vscode:cancelConsoleSession${i}`){if(i!==I)return;f()}},y=()=>{f()};l.on("console-message",u),l.on("destroyed",y),a.on("ipc-message",m),t.onCancellationRequested(f)}async findWebviewTarget(e,t){let{targetInfos:n}=await e.sendCommand("Target.getTargets");if(t.webviewId){let i="";for(let a of n)try{let l=new URL(a.url);if(l.searchParams.get("id")===t.webviewId){i=l.searchParams.get("extensionId")||"";break}}catch{}return i?n.find(a=>{try{let l=new URL(a.url),c=i==="ms-vscode.live-server"&&l.searchParams.get("serverWindowId")===t.webviewId,d=i==="vscode.simple-browser"&&l.searchParams.get("id")===t.webviewId&&l.searchParams.has("vscodeBrowserReqId");return!!(c||d)}catch{return!1}})?.targetId:void 0}if(t.browserViewId){let i=this.browserViewMainService.tryGetBrowserView(t.browserViewId)?.webContents;return n.find(a=>a.type!=="page"?!1:Vm.fromDevToolsTargetId(a.targetId)===i)?.targetId}}async waitForWebviewTargets(e,t){let n=Date.now(),i=1e4;for(;Date.now()-n<i;){let s=await this.findWebviewTarget(e,t);if(s)return s;await new Promise(a=>setTimeout(a,500))}e.detach()}async startDebugSession(e,t,n,i){let s=this.windowById(e);if(!s?.win)return;let l=Vm.getAllWebContents().find(d=>d.id===s.id);if(!l)return;let c=l.debugger;c.isAttached()||c.attach();try{if(!await this.waitForWebviewTargets(c,n))throw c.isAttached()&&c.detach(),new Error("No target found")}catch{throw c.isAttached()&&c.detach(),new Error("No target found")}s.win.webContents.on("ipc-message",async(d,u,f)=>{if(u===`vscode:cancelCurrentSession${i}`){if(i!==f)return;c.isAttached()&&c.detach(),s.win&&s.win.webContents.removeAllListeners("ipc-message")}})}async finishOverlay(e,t){e.isAttached()&&t&&(await e.sendCommand("Overlay.setInspectMode",{mode:"none",highlightConfig:{showInfo:!1,showStyles:!1}},t),await e.sendCommand("Overlay.hideHighlight",{},t),await e.sendCommand("Overlay.disable",{},t),e.detach())}async getElementData(e,t,n,i,s){let a=this.windowById(e);if(!a?.win)return;let c=Vm.getAllWebContents().find(I=>I.id===a.id);if(!c)return;let d=c.debugger;d.isAttached()||d.attach();let u;try{let I=await this.findWebviewTarget(d,i),{sessionId:k}=await d.sendCommand("Target.attachToTarget",{targetId:I,flatten:!0});u=k,await d.sendCommand("DOM.enable",{},k),await d.sendCommand("CSS.enable",{},k),await d.sendCommand("Overlay.enable",{},k),await d.sendCommand("Debugger.enable",{},k),await d.sendCommand("Runtime.enable",{},k),await d.sendCommand("Runtime.evaluate",{expression:`(function() {
							const style = document.createElement('style');
							style.id = '__pseudoBlocker__';
							style.textContent = '*::before, *::after { pointer-events: none !important; }';
							document.head.appendChild(style);
						})();`},k),await d.sendCommand("Overlay.setInspectMode",{mode:"searchForNode",highlightConfig:{showInfo:!0,showRulers:!1,showStyles:!0,showAccessibilityInfo:!0,showExtensionLines:!1,contrastAlgorithm:"aa",contentColor:{r:173,g:216,b:255,a:.8},paddingColor:{r:150,g:200,b:255,a:.5},borderColor:{r:120,g:180,b:255,a:.7},marginColor:{r:200,g:220,b:255,a:.4},eventTargetColor:{r:130,g:160,b:255,a:.8},shapeColor:{r:130,g:160,b:255,a:.8},shapeMarginColor:{r:130,g:160,b:255,a:.5},gridHighlightConfig:{rowGapColor:{r:140,g:190,b:255,a:.3},rowHatchColor:{r:140,g:190,b:255,a:.7},columnGapColor:{r:140,g:190,b:255,a:.3},columnHatchColor:{r:140,g:190,b:255,a:.7},rowLineColor:{r:120,g:180,b:255},columnLineColor:{r:120,g:180,b:255},rowLineDash:!0,columnLineDash:!0},flexContainerHighlightConfig:{containerBorder:{color:{r:120,g:180,b:255},pattern:"solid"},itemSeparator:{color:{r:140,g:190,b:255},pattern:"solid"},lineSeparator:{color:{r:140,g:190,b:255},pattern:"solid"},mainDistributedSpace:{hatchColor:{r:140,g:190,b:255,a:.7},fillColor:{r:140,g:190,b:255,a:.4}},crossDistributedSpace:{hatchColor:{r:140,g:190,b:255,a:.7},fillColor:{r:140,g:190,b:255,a:.4}},rowGapSpace:{hatchColor:{r:140,g:190,b:255,a:.7},fillColor:{r:140,g:190,b:255,a:.4}},columnGapSpace:{hatchColor:{r:140,g:190,b:255,a:.7},fillColor:{r:140,g:190,b:255,a:.4}}},flexItemHighlightConfig:{baseSizeBox:{hatchColor:{r:130,g:170,b:255,a:.6}},baseSizeBorder:{color:{r:120,g:180,b:255},pattern:"solid"},flexibilityArrow:{color:{r:130,g:190,b:255}}}}},k)}catch(I){throw d.detach(),new Error("No target found",{cause:I})}if(!u)throw d.detach(),new Error("No target session id found");let f=await this.getNodeData(u,d,a.win,s);await this.finishOverlay(d,u);let m=c.getZoomFactor(),y={x:t.x+f.bounds.x,y:t.y+f.bounds.y,width:f.bounds.width,height:f.bounds.height},v={x:Math.max(y.x,t.x),y:Math.max(y.y,t.y),width:Math.max(0,Math.min(y.x+y.width,t.x+t.width)-Math.max(y.x,t.x)),height:Math.max(0,Math.min(y.y+y.height,t.y+t.height)-Math.max(y.y,t.y))},S={x:v.x*m,y:v.y*m,width:v.width*m,height:v.height*m};return{outerHTML:f.outerHTML,computedStyle:f.computedStyle,bounds:S,ancestors:f.ancestors,attributes:f.attributes,computedStyles:f.computedStyles,dimensions:f.dimensions,innerText:f.innerText}}async getNodeData(e,t,n,i){return new Promise((s,a)=>{let l=async(c,d,u)=>{if(d==="Overlay.inspectNodeRequested"){t.off("message",l),await t.sendCommand("Runtime.evaluate",{expression:`(() => {
										const style = document.getElementById('__pseudoBlocker__');
										if (style) style.remove();
									})();`},e);let f=u?.backendNodeId;if(!f)throw new Error("Missing backendNodeId in inspectNodeRequested event");try{await t.sendCommand("DOM.getDocument",{},e);let{nodeIds:m}=await t.sendCommand("DOM.pushNodesByBackendIdsToFrontend",{backendNodeIds:[f]},e);if(!m||m.length===0)throw new Error("Failed to get node IDs.");let y=m[0],{model:v}=await t.sendCommand("DOM.getBoxModel",{nodeId:y},e);if(!v)throw new Error("Failed to get box model.");let S=v.content,I=v.margin,k=Math.min(I[0],S[0]),R=Math.min(I[1],S[1]),D=Math.max(I[2]-I[0],S[2]-S[0]),F=Math.max(I[5]-I[1],S[5]-S[1]),ce=await t.sendCommand("CSS.getMatchedStylesForNode",{nodeId:y},e);if(!ce)throw new Error("Failed to get matched css.");let B=this.formatMatchedStyles(ce),{outerHTML:ee}=await t.sendCommand("DOM.getOuterHTML",{nodeId:y},e);if(!ee)throw new Error("Failed to get outerHTML.");let z,Pe,Pt,Ft;try{let{object:Ur}=await t.sendCommand("DOM.resolveNode",{nodeId:y},e);if(Ur?.objectId){let{result:X}=await t.sendCommand("Runtime.callFunctionOn",{objectId:Ur.objectId,functionDeclaration:`function() {
										var chain = [];
										var el = this;
										while (el && el.nodeType === 1) {
											var entry = { tagName: el.tagName.toLowerCase() };
											if (el.id) { entry.id = el.id; }
											if (el.className && typeof el.className === 'string') {
												var cls = el.className.trim().split(/\\s+/).filter(Boolean);
												if (cls.length > 0) { entry.classNames = cls; }
											}
											chain.unshift(entry);
											el = el.parentElement;
										}
										return chain;
									}`,returnByValue:!0},e);X?.value&&Array.isArray(X.value)&&(z=X.value);let{result:$}=await t.sendCommand("Runtime.callFunctionOn",{objectId:Ur.objectId,functionDeclaration:`function() {
										var attrs = {};
										for (var i = 0; i < this.attributes.length; i++) {
											attrs[this.attributes[i].name] = this.attributes[i].value;
										}
										return attrs;
									}`,returnByValue:!0},e);$?.value&&(Pe=$.value);let{result:J}=await t.sendCommand("Runtime.callFunctionOn",{objectId:Ur.objectId,functionDeclaration:"function() { return this.innerText; }",returnByValue:!0},e);if(J?.value){let G=String(J.value).trim();Ft=G.length>100?G.substring(0,100)+"\u2026":G}}let{computedStyle:Nr}=await t.sendCommand("CSS.getComputedStyleForNode",{nodeId:y},e);if(Nr){Pt={};for(let X of Nr)X.name&&typeof X.value=="string"&&(Pt[X.name]=X.value)}}catch{}s({outerHTML:ee,computedStyle:B,bounds:{x:k,y:R,width:D,height:F},ancestors:z,attributes:Pe,computedStyles:Pt,dimensions:{top:R,left:k,width:D,height:F},innerText:Ft})}catch(m){t.off("message",l),t.detach(),a(m)}}};n.webContents.on("ipc-message",async(c,d,u)=>{if(d===`vscode:cancelElementSelection${i}`){if(i!==u)return;t.off("message",l),await this.finishOverlay(t,e),n.webContents.removeAllListeners("ipc-message")}}),t.on("message",l)})}formatMatchedStyles(e){let t=[];if(e.inlineStyle?.cssProperties?.length){t.push("/* Inline style */"),t.push("element {");for(let n of e.inlineStyle.cssProperties)n.name&&n.value&&t.push(`  ${n.name}: ${n.value};`);t.push(`}
`)}if(e.matchedCSSRules?.length)for(let n of e.matchedCSSRules){let i=n.rule,s=i.selectorList.selectors.map(a=>a.text).join(", ");t.push(`/* Matched Rule from ${i.origin} */`),t.push(`${s} {`);for(let a of i.style.cssProperties)a.name&&a.value&&t.push(`  ${a.name}: ${a.value};`);t.push(`}
`)}if(e.inherited?.length){let n=1;for(let i of e.inherited){let s=i.inlineStyle;s&&(t.push(`/* Inherited from ancestor level ${n} (inline) */`),t.push("element {"),t.push(s.cssText),t.push(`}
`));let a=i.matchedCSSRules||[];for(let l of a){let c=l.rule,d=c.selectorList.selectors.map(u=>u.text).join(", ");t.push(`/* Inherited from ancestor level ${n} (${c.origin}) */`),t.push(`${d} {`);for(let u of c.style.cssProperties)u.name&&u.value&&t.push(`  ${u.name}: ${u.value};`);t.push(`}
`)}n++}}return`
`+t.join(`
`)}windowById(e,t){return this.codeWindowById(e)??this.auxiliaryWindowById(e)??this.codeWindowById(t)}codeWindowById(e){if(typeof e=="number")return this.windowsMainService.getWindowById(e)}auxiliaryWindowById(e){if(typeof e!="number")return;let t=Vm.fromId(e);if(t)return this.auxiliaryWindowsMainService.getWindowByWebContents(t)}};Wl=T([g(0,Le),g(1,In),g(2,Ys)],Wl)});var mw,YP=w(()=>{mw="browserViewGroup"});var Hm,Ll,hw,gw=w(()=>{K();re();Za();Mt();nt();Nm();uw();he();Z();Hm=W("browserViewCDPProxyServer"),Ll=class extends C{constructor(e){super();this.logService=e;this.tokens=this._register(new hw);this.targets=new Map}async getWebSocketEndpointForTarget(e){await this.ensureServerStarted();let n=(await e.getTargetInfo()).targetId;this.targets.set(n,e);let i=await this.tokens.issueToken(n);return`ws://localhost:${this.port}/devtools/browser/${n}?token=${i}`}async removeTarget(e){let t=await e.getTargetInfo();this.targets.delete(t.targetId)}async ensureServerStarted(){if(this.server)return;let e=await import("http");this.server=e.createServer(),await new Promise((n,i)=>{this.server.listen(0,"127.0.0.1",()=>n()),this.server.once("error",i)});let t=this.server.address();this.port=t.port,this.server.on("request",(n,i)=>this.handleHttpRequest(n,i)),this.server.on("upgrade",(n,i)=>this.handleWebSocketUpgrade(n,i))}async handleHttpRequest(e,t){this.logService.debug(`[BrowserViewDebugProxy] HTTP request at ${e.url}`),t.writeHead(404),t.end()}handleWebSocketUpgrade(e,t){let[n,i]=(e.url||"").split("?"),s=n.match(/^\/devtools\/browser\/([^/?]+)$/);if(this.logService.debug(`[BrowserViewDebugProxy] WebSocket upgrade requested: ${n}`),!s){this.logService.warn(`[BrowserViewDebugProxy] Rejecting WebSocket on unknown path: ${n}`),t.write(`HTTP/1.1 404 Not Found\r
\r
`),t.end();return}let a=s[1],l=new URLSearchParams(i).get("token"),c=l&&this.tokens.consumeToken(l);if(!c||c!==a){t.write(`HTTP/1.1 401 Unauthorized\r
\r
`),t.end();return}let d=this.targets.get(a);if(!d){this.logService.warn(`[BrowserViewDebugProxy] Browser target not found: ${a}`),t.write(`HTTP/1.1 404 Not Found\r
\r
`),t.end();return}this.logService.debug(`[BrowserViewDebugProxy] WebSocket connected: ${n}`);let u=Rf(e,t,{debugLabel:"browser-view-cdp-"+xe(),enableMessageSplitting:!1});if(!u)return;let f=new Yo(d),m=this.wireWebSocket(u,f);this._register(m),this._register(u)}wireWebSocket(e,t){let n=new te;return n.add(e.onData(i=>{try{let s=i.toString(),{id:a,method:l,params:c,sessionId:d}=JSON.parse(s);this.logService.debug(`[BrowserViewDebugProxy] <- ${s}`),t.sendMessage(l,c,d).then(u=>{let m=JSON.stringify({id:a,result:u,sessionId:d});this.logService.debug(`[BrowserViewDebugProxy] -> ${m}`),e.write(H.fromString(m))}).catch(u=>{let f={id:a,error:{code:u instanceof ao?u.code:_u.ServerError,message:u.message||"Unknown error"},sessionId:d},m=JSON.stringify(f);this.logService.debug(`[BrowserViewDebugProxy] -> ${m}`),e.write(H.fromString(m))})}catch(s){this.logService.error("[BrowserViewDebugProxy] Error parsing message:",s),e.end()}})),n.add(t.onEvent(i=>{let s=JSON.stringify(i);this.logService.debug(`[BrowserViewDebugProxy] -> ${s}`),e.write(H.fromString(s))})),n.add(t.onClose(()=>{this.logService.debug("[BrowserViewDebugProxy] WebSocket closing"),e.end()})),n.add(e.onClose(()=>{this.logService.debug("[BrowserViewDebugProxy] WebSocket closed"),t.dispose(),n.dispose()})),n}dispose(){this.server&&(this.server.close(),this.server=void 0),super.dispose()}};Ll=T([g(0,O)],Ll);hw=class extends C{constructor(){super(...arguments);this.tokens=new Map}async issueToken(e){let t=this.makeToken();return this.tokens.set(t,{details:Object.freeze(e),expiresAt:Date.now()+3e4}),this._register(df(()=>this.tokens.delete(t),3e4)),t}consumeToken(e){if(!e)return;let t=this.tokens.get(e);if(t)return this.tokens.delete(e),Date.now()<=t.expiresAt?t.details:void 0}makeToken(){let e=crypto.getRandomValues(new Uint8Array(32)),t=Array.from(e).map(s=>String.fromCharCode(s)).join("");return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}}});var Al,ZP=w(()=>{K();Q();cw();Nm();gw();Bm();Al=class extends C{constructor(e,t,n){super();this.id=e;this.browserViewMainService=t;this.cdpProxyServer=n;this.views=new Map;this.viewListeners=this._register(new te);this.knownContextIds=new Set;this.ownedContextIds=new Set;this._onTargetCreated=this._register(new x);this.onTargetCreated=this._onTargetCreated.event;this._onTargetDestroyed=this._register(new x);this.onTargetDestroyed=this._onTargetDestroyed.event;this._onDidAddView=this._register(new x);this.onDidAddView=this._onDidAddView.event;this._onDidRemoveView=this._register(new x);this.onDidRemoveView=this._onDidRemoveView.event;this._onDidDestroy=this._register(new x);this.onDidDestroy=this._onDidDestroy.event}async addView(e){if(this.views.has(e))return;let t=this.browserViewMainService.tryGetBrowserView(e);if(!t)throw new Error(`Browser view ${e} not found`);this.views.set(t.id,t),this.knownContextIds.add(t.session.id),this._onDidAddView.fire({viewId:t.id}),this._onTargetCreated.fire(t),this.viewListeners.add(E.once(t.onDidClose)(()=>{this.removeView(e)}))}async removeView(e){let t=this.views.get(e);t&&this.views.delete(e)&&(!this.ownedContextIds.has(t.session.id)&&![...this.views.values()].some(n=>n.session.id===t.session.id)&&this.knownContextIds.delete(t.session.id),this._onDidRemoveView.fire({viewId:t.id}),this._onTargetDestroyed.fire(t))}getVersion(){return this.browserViewMainService.getVersion()}getWindowForTarget(e){return this.browserViewMainService.getWindowForTarget(e)}async attach(){return new Yo(this)}async getTargetInfo(){return{targetId:this.id,type:"browser",title:this.getVersion().product,url:"",attached:!0,canAccessOpener:!1}}getTargets(){return this.views.values()}async createTarget(e,t){if(t&&!this.knownContextIds.has(t))throw new Error(`Unknown browser context ${t}`);let n=await this.browserViewMainService.createTarget(e,t);return n instanceof Dn&&await this.addView(n.id),n}async activateTarget(e){return this.browserViewMainService.activateTarget(e)}async closeTarget(e){return e instanceof Dn&&await this.removeView(e.id),this.browserViewMainService.closeTarget(e)}getBrowserContexts(){return[...this.knownContextIds]}async createBrowserContext(){let e=await this.browserViewMainService.createBrowserContext();return this.knownContextIds.add(e),this.ownedContextIds.add(e),e}async disposeBrowserContext(e){if(!this.ownedContextIds.has(e))throw new Error("Can only dispose browser contexts created by this group");for(let t of this.views.values())t.session.id===e&&await this.removeView(t.id);return this.knownContextIds.delete(e),this.ownedContextIds.delete(e),this.browserViewMainService.disposeBrowserContext(e)}async getDebugWebSocketEndpoint(){return this.cdpProxyServer.getWebSocketEndpointForTarget(this)}dispose(){this._onDidDestroy.fire(),this.cdpProxyServer.removeTarget(this),super.dispose()}};Al=T([g(1,Ys),g(2,Hm)],Al)});var vw,Ml,e0=w(()=>{K();Q();Z();Mt();ZP();vw=W("browserViewGroupMainService"),Ml=class extends C{constructor(e){super();this.instantiationService=e;this.groups=this._register(new cr)}async createGroup(){let e=xe(),t=this.instantiationService.createInstance(Al,e);return this.groups.set(e,t),E.once(t.onDidDestroy)(()=>{this.groups.deleteAndLeak(e)}),e}async destroyGroup(e){this.groups.deleteAndDispose(e)}async addViewToGroup(e,t){return this._getGroup(e).addView(t)}async removeViewFromGroup(e,t){return this._getGroup(e).removeView(t)}async getDebugWebSocketEndpoint(e){return this._getGroup(e).getDebugWebSocketEndpoint()}onDynamicDidAddView(e){return this._getGroup(e).onDidAddView}onDynamicDidRemoveView(e){return this._getGroup(e).onDidRemoveView}onDynamicDidDestroy(e){return this._getGroup(e).onDidDestroy}_getGroup(e){let t=this.groups.get(e);if(!t)throw new Error(`Browser view group ${e} not found`);return t}};Ml=T([g(0,Vt)],Ml)});import pW from"assert";function fW(o,r){let e=(l,c)=>{console.warn(h(1948,null,l,c))},t=l=>{console.warn(h(1946,null,l))},n=(l,c)=>{console.warn(h(1945,null,l,c))},i=l=>({onUnknownOption:c=>{Oy.includes(l)||console.warn(h(1950,null,c,l))},onMultipleValues:e,onEmptyValue:t,onDeprecatedOption:n,getSubcommandReporter:Oy.includes(l)?i:void 0}),a=yu(o,Sm,r?{onUnknownOption:l=>{console.warn(h(1949,null,l))},onMultipleValues:e,onEmptyValue:t,onDeprecatedOption:n,getSubcommandReporter:i}:void 0);return a.goto&&a._.forEach(l=>pW(/^(\w:)?[^:]+(:\d*){0,2}:?$/.test(l),h(1947,null))),a}function mW(o){let r=o.findIndex(e=>!/^-/.test(e));if(r>-1)return[...o.slice(0,r),...o.slice(r+1)]}function t0(o){let[,...r]=o;if(M&&r.length>0){let t=It(r[0]).toLowerCase(),n=$e(process.execPath).toLowerCase()+"\\";t.startsWith(n)&&t.endsWith("\\resources\\app\\out\\cli.js")&&r.shift()}process.env.VSCODE_DEV&&(r=mW(r)||[]);let e=!ei(process.env);return fW(r,e)}function r0(o,...r){let e=o.indexOf("--");return e===-1?o.push(...r):o.splice(e,0,...r),o}function ei(o){return o.VSCODE_CLI==="1"}var Ol=w(()=>{Se();Y();Ce();Fy()});import*as yw from"os";function vW({useAlternateBitness:o=!1}={}){return o?Ru===0?process.env["ProgramFiles(x86)"]||null:Fl===0&&process.env.ProgramW6432||null:process.env.ProgramFiles||null}async function Km({useAlternateBitness:o=!1,findPreview:r=!1}={}){let e=vW({useAlternateBitness:o});if(!e)return null;let t=U(e,"PowerShell");if(!await Yt.existsDirectory(t))return null;let n=-1,i=null;for(let l of await q.readdir(t)){let c=-1;if(r){let u=l.indexOf("-");if(u<0)continue;let f=l.substring(0,u);if(!n0.test(f)||l.substring(u+1)!=="preview")continue;c=parseInt(f,10)}else{if(!n0.test(l))continue;c=parseInt(l,10)}if(c<=n)continue;let d=U(t,l,"pwsh.exe");await Yt.existsFile(d)&&(i=d,n=c)}if(!i)return null;let s=e.includes("x86")?" (x86)":"",a=r?" Preview":"";return new Zs(i,`PowerShell${a}${s}`,!0)}async function i0({findPreview:o}={}){if(!process.env.LOCALAPPDATA)return null;let r=U(process.env.LOCALAPPDATA,"Microsoft","WindowsApps");if(!await Yt.existsDirectory(r))return null;let{pwshMsixDirRegex:e,pwshMsixName:t}=o?{pwshMsixDirRegex:gW,pwshMsixName:"PowerShell Preview (Store)"}:{pwshMsixDirRegex:hW,pwshMsixName:"PowerShell (Store)"};for(let n of await q.readdir(r))if(e.test(n)){let i=U(r,n,"pwsh.exe");return new Zs(i,t)}return null}function yW(){let o=U(yw.homedir(),".dotnet","tools","pwsh.exe");return new Zs(o,".NET Core PowerShell Global Tool")}function wW(){let o=U(yw.homedir(),"scoop","apps"),r=U(o,"pwsh","current","pwsh.exe");return new Zs(r,"PowerShell (Scoop)")}function IW(){let o=U(process.env.windir,Ru===1&&Fl!==1?"SysNative":"System32","WindowsPowerShell","v1.0","powershell.exe");return new Zs(o,"Windows PowerShell",!0)}async function*bW(){let o=await Km();o&&(yield o),o=await Km({useAlternateBitness:!0}),o&&(yield o),o=await i0(),o&&(yield o),o=yW(),o&&(yield o),o=await Km({findPreview:!0}),o&&(yield o),o=await i0({findPreview:!0}),o&&(yield o),o=await Km({useAlternateBitness:!0,findPreview:!0}),o&&(yield o),o=await wW(),o&&(yield o),o=IW(),o&&(yield o)}async function*ww(){for await(let o of bW())await o.exists()&&(yield o)}async function o0(){for await(let o of ww())return o;return null}var n0,hW,gW,Ru,Fl,Zs,Iw=w(()=>{Se();jt();n0=/^\d+$/,hW=/^Microsoft.PowerShell_.*/,gW=/^Microsoft.PowerShellPreview_.*/;switch(process.arch){case"ia32":Ru=1;break;case"arm":case"arm64":Ru=2;break;default:Ru=0;break}process.env.PROCESSOR_ARCHITEW6432?Fl=process.env.PROCESSOR_ARCHITEW6432==="ARM64"?2:0:process.env.PROCESSOR_ARCHITECTURE==="ARM64"?Fl=2:process.env.PROCESSOR_ARCHITECTURE==="X86"?Fl=1:Fl=0;Zs=class{constructor(r,e,t){this.exePath=r;this.displayName=e;this.knownToExist=t}async exists(){return this.knownToExist===void 0&&(this.knownToExist=await Yt.existsFile(this.exePath)),this.knownToExist}}});import*as bw from"child_process";import{promises as s0}from"fs";function $m(o=Sr){return o.comspec||"cmd.exe"}function a0(o){let r=[],e=!1,t=function(n){if(e){r.push(n);return}(!o.send(n,s=>{if(s&&console.error(s),e=!1,r.length>0){let a=r.slice(0);r=[],a.forEach(l=>t(l))}})||M)&&(e=!0)};return{send:t}}async function SW(o){if(await q.exists(o)){let r;try{r=await s0.stat(o)}catch(e){e.message.startsWith("EACCES")&&(r=await s0.lstat(o))}return r?!r.isDirectory():!1}return!1}async function Du(o,r,e,t=Sr,n=SW){if(bo(o))return await n(o)?o:void 0;if(r===void 0&&(r=mn()),$e(o)!=="."){let l=U(r,o);return await n(l)?l:void 0}let s=$y(t,"PATH");if(e===void 0&&Ae(s)&&(e=s.split(Fp)),e===void 0||e.length===0){let l=U(r,o);return await n(l)?l:void 0}for(let l of e){let c;if(bo(l)?c=U(l,o):c=U(r,l,o),M){let u=($y(t,"PATHEXT")||".COM;.EXE;.BAT;.CMD").split(";").map(async f=>{let m=c+f;return await n(m)?m:void 0});for(let f of u){let m=await f;if(m)return m}}if(await n(c))return c}let a=U(r,o);return await n(a)?a:void 0}async function l0(o,r=!1){let e;if(M){let t=process.env.WINDIR||"C:\\Windows",n=U(t,"System32","taskkill.exe"),i=["/T"];r&&i.push("/F"),i.push("/PID",String(o)),e=bw.spawn(n,i,{stdio:["ignore","pipe","pipe"]})}else{let t=et.asFileUri("vs/base/node/terminateProcess.sh").fsPath;e=bw.spawn("/bin/sh",[t,String(o),r?"9":"15"],{stdio:["ignore","pipe","pipe"]})}return new Promise((t,n)=>{let i=[];e.stdout.on("data",s=>i.push(s)),e.stderr.on("data",s=>i.push(s)),e.on("error",n),e.on("exit",s=>{s===0?t():n(new Error(`taskkill exited with code ${s}: ${Buffer.concat(i).toString()}`))})})}var Ul=w(()=>{yn();Se();Y();Bn();Pu();We();jt();ze()});import{userInfo as xW}from"os";async function qm(o,r){return o===1?M?EW():$m(r):PW(o,r)}function PW(o,r){if(ne&&o===2||V&&o===3)return"/bin/bash";if(!Sw){let e;if(M)e="/bin/bash";else{if(e=r.SHELL,!e)try{e=xW().shell}catch{}e||(e="sh"),e==="/bin/false"&&(e="/bin/bash")}Sw=e}return Sw}async function EW(){return xw||(xw=(await o0()).exePath),xw}var Sw,xw,Pw=w(()=>{Y();Iw();Ul();Sw=null;xw=null});function d0(o,r,e){return Math.min(Math.max(o,r),e)}var u0=w(()=>{Ca()});import{spawn as TW}from"child_process";async function Nl(o,r,e,t){return e["force-disable-user-env"]?(r.trace("resolveShellEnv(): skipped (--force-disable-user-env)"),{}):M?(r.trace("resolveShellEnv(): skipped (Windows)"),{}):ei(t)&&!e["force-user-env"]?(r.trace("resolveShellEnv(): skipped (VSCODE_CLI is set)"),{}):(ei(t)?r.trace("resolveShellEnv(): running (--force-user-env)"):r.trace("resolveShellEnv(): running (macOS/Linux)"),Ew||(Ew=wt.withAsyncBody(async(n,i)=>{let s=new qe,a=1e4,l=o.getValue("application.shellEnvironmentResolutionTimeout");typeof l=="number"&&(a=d0(l,1,120)*1e3);let c=setTimeout(()=>{s.dispose(!0),i(new Error(h(2295,null)))},a);try{n(await CW(r,s.token))}catch(d){!id(d)&&!s.token.isCancellationRequested?i(new Error(h(2293,null,Tr(d)))):n({})}finally{clearTimeout(c),s.dispose()}})),Ew)}async function CW(o,r){let e=process.env.ELECTRON_RUN_AS_NODE;o.trace("getUnixShellEnvironment#runAsNode",e);let t=process.env.ELECTRON_NO_ATTACH_CONSOLE;o.trace("getUnixShellEnvironment#noAttach",t);let n=xe().replace(/-/g,"").substr(0,12),i=new RegExp(n+"({.*})"+n),s={...process.env,ELECTRON_RUN_AS_NODE:"1",ELECTRON_NO_ATTACH_CONSOLE:"1",VSCODE_RESOLVING_ENVIRONMENT:"1"};o.trace("getUnixShellEnvironment#env",s);let a=await qm(Lt,s);return o.trace("getUnixShellEnvironment#shell",a),new Promise((l,c)=>{if(r.isCancellationRequested)return c(new Et);let d=ye(a),u,f,m="";/^(?:pwsh|powershell)(?:-preview)?$/.test(d)?(u=`& '${process.execPath}' ${m} -p '''${n}'' + JSON.stringify(process.env) + ''${n}'''`,f=["-Login","-Command"]):d==="nu"?(u=`^'${process.execPath}' ${m} -p '"${n}" + JSON.stringify(process.env) + "${n}"'`,f=["-i","-l","-c"]):d==="xonsh"?(u=`import os, json; print("${n}", json.dumps(dict(os.environ)), "${n}")`,f=["-i","-l","-c"]):(u=`'${process.execPath}' ${m} -p '"${n}" + JSON.stringify(process.env) + "${n}"'`,d==="tcsh"||d==="csh"?f=["-ic"]:f=["-i","-l","-c"]),o.trace("getUnixShellEnvironment#spawn",JSON.stringify(f),u);let y=TW(a,[...f,u],{detached:!0,stdio:["ignore","pipe","pipe"],env:s});r.onCancellationRequested(()=>(y.kill(),c(new Et))),y.on("error",I=>{o.error("getUnixShellEnvironment#errorChildProcess",Tr(I)),c(I)});let v=[];y.stdout.on("data",I=>v.push(I));let S=[];y.stderr.on("data",I=>S.push(I)),y.on("close",(I,k)=>{let R=Buffer.concat(v).toString("utf8");o.trace("getUnixShellEnvironment#raw",R);let D=Buffer.concat(S).toString("utf8");if(D.trim()&&o.trace("getUnixShellEnvironment#stderr",D),I||k)return c(new Error(h(2294,null,I,k)));let F=i.exec(R),ce=F?F[1]:"{}";try{let B=JSON.parse(ce);e?B.ELECTRON_RUN_AS_NODE=e:delete B.ELECTRON_RUN_AS_NODE,t?B.ELECTRON_NO_ATTACH_CONSOLE=t:delete B.ELECTRON_NO_ATTACH_CONSOLE,delete B.VSCODE_RESOLVING_ENVIRONMENT,delete B.XDG_RUNTIME_DIR,o.trace("getUnixShellEnvironment#result",B),l(B)}catch(B){o.error("getUnixShellEnvironment#errorCaught",Tr(B)),c(B)}})})}var Ew,zm=w(()=>{Se();Ce();St();Ro();Ve();Y();Mt();Pw();Ol();he();u0()});var Tw,p0,f0=w(()=>{Z();Tw=W("extensionHostStarter"),p0="extensionHostStarter"});var Zo,m0=w(()=>{he();Ve();Q();K();xt();re();ir();Js();Wt();st();Zo=class extends C{constructor(e,t,n,i,s){super();this._logService=e;this._lifecycleMainService=t;this._windowsMainService=n;this._telemetryService=i;this._configurationService=s;this._extHosts=new Map;this._shutdown=!1;this._register(this._lifecycleMainService.onWillShutdown(a=>{this._shutdown=!0,a.join("extHostStarter",this._waitForAllExit(6e3))}))}static{this._lastId=0}dispose(){super.dispose()}_getExtHost(e){let t=this._extHosts.get(e);if(!t)throw new Error("Unknown extension host!");return t}onDynamicStdout(e){return this._getExtHost(e).onStdout}onDynamicStderr(e){return this._getExtHost(e).onStderr}onDynamicMessage(e){return this._getExtHost(e).onMessage}onDynamicExit(e){return this._getExtHost(e).onExit}async createExtensionHost(){if(this._shutdown)throw ci();let e=String(++Zo._lastId),t=new Jo(this._logService,this._windowsMainService,this._telemetryService,this._lifecycleMainService);this._extHosts.set(e,t);let n=t.onExit(({pid:i,code:s,signal:a})=>{n.dispose(),this._logService.info(`Extension host with pid ${i} exited with code: ${s}, signal: ${a}.`),setTimeout(()=>{t.dispose(),this._extHosts.delete(e)}),setTimeout(()=>{try{process.kill(i,0),this._logService.error(`Extension host with pid ${i} still exists, forcefully killing it...`),process.kill(i)}catch{}},1e3)});return{id:e}}async start(e,t){if(this._shutdown)throw ci();let n=this._getExtHost(e),i=["--skipWorkspaceStorageLock"];return this._configurationService.getValue("extensions.supportNodeGlobalNavigator")&&i.push("--supportGlobalNavigator"),n.start({...t,type:"extensionHost",name:"extension-host",entryPoint:"vs/workbench/api/node/extensionHostProcess",args:i,execArgv:t.execArgv,allowLoadingUnsignedLibraries:!0,respondToAuthRequestsFromMainProcess:!0,windowLifecycleBound:!0,windowLifecycleGraceTime:6e3,correlationId:e}),{pid:await E.toPromise(n.onSpawn)}}async enableInspectPort(e){if(this._shutdown)throw ci();let t=this._extHosts.get(e);return t?t.enableInspectPort():!1}async kill(e){if(this._shutdown)throw ci();let t=this._extHosts.get(e);t&&t.kill()}async _killAllNow(){for(let[,e]of this._extHosts)e.kill()}async _waitForAllExit(e){let t=[];for(let[,n]of this._extHosts)t.push(n.waitForExit(e));return wt.settled(t).then(()=>{})}};Zo=T([g(0,O),g(1,me),g(2,Le),g(3,ot),g(4,ge)],Zo)});var Wu,h0=w(()=>{Z();Wu=W("externalTerminal")});var gG,Bl,g0=w(()=>{Z();gG=W("externalTerminal"),Bl="Terminal.app"});import*as es from"child_process";function ea(o){let r={...o.env};return UP(r),r}function y0(o){return o.errno==="ENOENT"&&o.path?new Error(h(2058,null,o.path)):o}function Cw(o,r,e,t){let n="";o.on("error",i=>{e(y0(i))}),o.stderr?.on("data",i=>{n+=i.toString()}),o.on("exit",i=>{if(i===0)r(void 0);else if(n){let s=n.split(`
`,1);e(new Error(s[0]))}else e(new Error(h(2061,null,t,i)))})}function _W(o){let r="";for(let e of o)e.indexOf(" ")>=0?r+='"'+e+'"':r+=e,r+=" ";return r}var v0,Lu,ti,Au,Gm,Mu,w0=w(()=>{Wo();ze();Se();Y();Pu();jt();Ul();Ce();g0();v0=h(2057,null),Lu=class{async getDefaultTerminalForPlatforms(){return{windows:Au.getDefaultTerminalWindows(),linux:await Mu.getDefaultTerminalLinuxReady(),osx:Bl}}},ti=class ti extends Lu{static{this.CMD="cmd.exe"}openTerminal(r,e){return this.spawnTerminal(es,r,$m(),e)}spawnTerminal(r,e,t,n){let i=e.windowsExec||ti.getDefaultTerminalWindows();n&&n[1]===":"&&(n=n[0].toUpperCase()+n.substr(1));let s=ye(i,".exe").toLowerCase();if(s==="cmder")return r.spawn(i,n?[n]:void 0),Promise.resolve(void 0);let a=["/c","start","/wait"];return i.indexOf(" ")>=0&&a.push(i),a.push(i),s==="wt"&&a.push("-d ."),new Promise((l,c)=>{let d=ea(process),u=r.spawn(t,a,{cwd:n,env:d,detached:!0});u.on("error",c),u.on("exit",()=>l())})}async runInTerminal(r,e,t,n,i){let s=i.windowsExec||ti.getDefaultTerminalWindows(),a=await ti.getWtExePath();return new Promise((l,c)=>{let d=`"${e} - ${v0}"`,u=`"${t.join('" "')}" & pause`,f=Object.assign({},ea(process),n);Object.keys(f).filter(I=>f[I]===null).forEach(I=>delete f[I]);let m={cwd:e,env:f,windowsVerbatimArguments:!0},y,v;ye(s,".exe")==="wt"?(y=s,v=["-d",".",ti.CMD,"/c",u]):a?(y=a,v=["-d",".",s,"/c",u]):(y=ti.CMD,v=["/c","start",d,"/wait",s,"/c",`"${u}"`]),es.spawn(y,v,m).on("error",I=>{c(y0(I))}),l(void 0)})}static getDefaultTerminalWindows(){if(!ti._DEFAULT_TERMINAL_WINDOWS){let r=!!process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432");ti._DEFAULT_TERMINAL_WINDOWS=`${process.env.windir?process.env.windir:"C:\\Windows"}\\${r?"Sysnative":"System32"}\\cmd.exe`}return ti._DEFAULT_TERMINAL_WINDOWS}static async getWtExePath(){try{return await Du("wt")}catch{return}}};T([de],ti,"getWtExePath",1);Au=ti,Gm=class o extends Lu{static{this.OSASCRIPT="/usr/bin/osascript"}openTerminal(r,e){return this.spawnTerminal(es,r,e)}runInTerminal(r,e,t,n,i){let s=i.osxExec||Bl;return new Promise((a,l)=>{if(s===Bl||s==="iTerm.app"){let c=s===Bl?"TerminalHelper":"iTermHelper",u=[et.asFileUri(`vs/workbench/contrib/externalTerminal/node/${c}.scpt`).fsPath,"-t",r||v0,"-w",e];for(let m of t)u.push("-a"),u.push(m);if(n){let m=Object.assign({},ea(process),n);for(let y in m){let v=m[y];v===null?(u.push("-u"),u.push(y)):(u.push("-e"),u.push(`${y}=${v}`))}}let f=es.spawn(o.OSASCRIPT,u);Cw(f,a,l,s)}else if(s==="Ghostty.app"){let c=Object.assign({},ea(process),n),d=["-na","Ghostty.app","--args"];d.push("--working-directory="+e),d.push("--wait-after-command=true"),d.push("-e",...t);let u=es.spawn("/usr/bin/open",d,{env:c});Cw(u,a,l,s)}else l(new Error(h(2059,null,s)))})}spawnTerminal(r,e,t){let n=e.osxExec||Bl;return new Promise((i,s)=>{let a=["-a",n];t&&a.push(t);let l=ea(process),c=r.spawn("/usr/bin/open",a,{cwd:t,env:l});c.on("error",s),c.on("exit",()=>i())})}},Mu=class o extends Lu{static{this.WAIT_MESSAGE=h(2060,null)}openTerminal(r,e){return this.spawnTerminal(es,r,e)}runInTerminal(r,e,t,n,i){let s=i.linuxExec?Promise.resolve(i.linuxExec):o.getDefaultTerminalLinuxReady();return new Promise((a,l)=>{s.then(c=>{if(ye(c).toLowerCase()==="ghostty"){let m=[];e&&m.push(`--working-directory=${e}`),m.push("--wait-after-command=true"),t.length&&m.push("-e",...t),o.spawnTerminalWithEnv(c,m,e,n,a,l);return}let u=[];c.indexOf("gnome-terminal")>=0?u.push("-x"):u.push("-e"),u.push("bash"),u.push("-c");let f=`${_W(t)}; echo; read -p "${o.WAIT_MESSAGE}" -n1;`;u.push(`''${f}''`),o.spawnTerminalWithEnv(c,u,e,n,a,l)})})}static spawnTerminalWithEnv(r,e,t,n,i,s){let a=Object.assign({},ea(process),n);Object.keys(a).filter(c=>a[c]===null).forEach(c=>delete a[c]);let l=es.spawn(r,e,{cwd:t,env:a});Cw(l,i,s,r)}static async getDefaultTerminalLinuxReady(){if(!o._DEFAULT_TERMINAL_LINUX_READY)if(!ne)o._DEFAULT_TERMINAL_LINUX_READY=Promise.resolve("xterm");else{let r=await q.exists("/etc/debian_version");o._DEFAULT_TERMINAL_LINUX_READY=new Promise(e=>{r?e("x-terminal-emulator"):process.env.DESKTOP_SESSION==="gnome"||process.env.DESKTOP_SESSION==="gnome-classic"?e("gnome-terminal"):process.env.DESKTOP_SESSION==="kde-plasma"?e("konsole"):process.env.COLORTERM?e(process.env.COLORTERM):process.env.TERM?e(process.env.TERM):e("xterm")})}return o._DEFAULT_TERMINAL_LINUX_READY}spawnTerminal(r,e,t){let n=e.linuxExec?Promise.resolve(e.linuxExec):o.getDefaultTerminalLinuxReady();return new Promise((i,s)=>{n.then(a=>{let l=ea(process),d=ye(a).toLowerCase()==="ghostty"&&t?[`--working-directory=${t}`]:[],u=r.spawn(a,d,{cwd:t,env:l});u.on("error",s),u.on("exit",()=>i())})})}}});function b0(o,r){switch(o){case 0:return"";case 1:return`${Jm}*?`;default:return`(?:${jm}|${Jm}+${jm}${r?`|${jm}${Jm}+`:""})*?`}}function S0(o,r){if(!o)return[];let e=[],t=!1,n=!1,i="";for(let s of o){switch(s){case r:if(!t&&!n){e.push(i),i="";continue}break;case"{":t=!0;break;case"}":t=!1;break;case"[":n=!0;break;case"]":n=!1;break}i+=s}return i&&e.push(i),e}function C0(o){if(!o)return"";let r="",e=S0(o,I0);if(e.every(t=>t===Vl))r=".*";else{let t=!1;e.forEach((n,i)=>{if(n===Vl){if(t)return;r+=b0(2,i===e.length-1)}else{let s=!1,a="",l=!1,c="";for(let d of n){if(d!=="}"&&s){a+=d;continue}if(l&&(d!=="]"||!c)){let u;d==="-"?u=d:(d==="^"||d==="!")&&!c?u="^":d===I0?u="":u=Po(d),c+=u;continue}switch(d){case"{":s=!0;continue;case"[":l=!0;continue;case"}":{let f=`(?:${S0(a,",").map(m=>C0(m)).join("|")})`;r+=f,s=!1,a="";break}case"]":{r+="["+c+"]",l=!1,c="";break}case"?":r+=Jm;continue;case"*":r+=b0(1);continue;default:r+=Po(d)}}i<e.length-1&&(e[i+1]!==Vl||i+2<e.length)&&(r+=jm)}t=n===Vl})}return r}function kw(o,r){if(!o)return ki;let e;typeof o!="string"?e=o.pattern:e=o,e=e.trim();let t=r.ignoreCase??!1,n={...r,equals:t?Hr:(l,c)=>l===c,endsWith:t?$S:(l,c)=>l.endsWith(c),isEqualOrParent:(l,c)=>$i(l,c,!ne||t)},i=`${t?e.toLowerCase():e}_${!!r.trimForExclusions}_${t}`,s=x0.get(i);if(s)return E0(s,o,n);let a;return RW.test(e)?s=OW(e.substring(4),e,n):(a=DW.exec(_w(e,n)))?s=FW(a[1],e,n):(r.trimForExclusions?LW:WW).test(e)?s=UW(e,n):(a=AW.exec(_w(e,n)))?s=T0(a[1].substring(1),e,!0,n):(a=MW.exec(_w(e,n)))?s=T0(a[1],e,!1,n):s=NW(e,n),x0.set(i,s),E0(s,o,n)}function E0(o,r,e){if(typeof r=="string")return o;let t=function(n,i){return e.isEqualOrParent(n,r.base)?o(gv(n.substring(r.base.length),Bt),i):null};return t.allBasenames=o.allBasenames,t.allPaths=o.allPaths,t.basenames=o.basenames,t.patterns=o.patterns,t}function _w(o,r){return r.trimForExclusions&&o.endsWith("/**")?o.substring(0,o.length-2):o}function OW(o,r,e){return function(t,n){return typeof t=="string"&&e.endsWith(t,o)?r:null}}function FW(o,r,e){let t=`/${o}`,n=`\\${o}`,i=function(a,l){return typeof a!="string"?null:l?e.equals(l,o)?r:null:e.equals(a,o)||e.endsWith(a,t)||e.endsWith(a,n)?r:null},s=[o];return i.basenames=s,i.patterns=[r],i.allBasenames=s,i}function UW(o,r){let e=k0(o.slice(1,-1).split(",").map(a=>kw(a,r)).filter(a=>a!==ki),o),t=e.length;if(!t)return ki;if(t===1)return e[0];let n=function(a,l){for(let c=0,d=e.length;c<d;c++)if(e[c](a,l))return o;return null},i=e.find(a=>!!a.allBasenames);i&&(n.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(n.allPaths=s),n}function T0(o,r,e,t){let n=Bt===ue.sep,i=n?o:o.replace(kW,Bt),s=Bt+i,a=ue.sep+o,l;return e?l=function(c,d){return typeof c=="string"&&(t.equals(c,i)||t.endsWith(c,s)||!n&&(t.equals(c,o)||t.endsWith(c,a)))?r:null}:l=function(c,d){return typeof c=="string"&&(t.equals(c,i)||!n&&t.equals(c,o))?r:null},l.allPaths=[(e?"*/":"./")+o],l}function NW(o,r){try{let e=new RegExp(`^${C0(o)}$`,r.ignoreCase?"i":void 0);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?o:null}}catch{return ki}}function _0(o,r={}){if(!o)return P0;if(typeof o=="string"||BW(o)){let e=kw(o,r);if(e===ki)return P0;let t=function(n,i){return!!e(n,i)};return e.allBasenames&&(t.allBasenames=e.allBasenames),e.allPaths&&(t.allPaths=e.allPaths),t}return VW(o,r)}function BW(o){let r=o;return r?typeof r.base=="string"&&typeof r.pattern=="string":!1}function VW(o,r){let e=k0(Object.getOwnPropertyNames(o).map(a=>HW(a,o[a],r)).filter(a=>a!==ki)),t=e.length;if(!t)return ki;if(!e.some(a=>!!a.requiresSiblings)){if(t===1)return e[0];let a=function(d,u){let f;for(let m=0,y=e.length;m<y;m++){let v=e[m](d,u);if(typeof v=="string")return v;cf(v)&&(f||(f=[]),f.push(v))}return f?(async()=>{for(let m of f){let y=await m;if(typeof y=="string")return y}return null})():null},l=e.find(d=>!!d.allBasenames);l&&(a.allBasenames=l.allBasenames);let c=e.reduce((d,u)=>u.allPaths?d.concat(u.allPaths):d,[]);return c.length&&(a.allPaths=c),a}let n=function(a,l,c){let d,u;for(let f=0,m=e.length;f<m;f++){let y=e[f];y.requiresSiblings&&c&&(l||(l=ye(a)),d||(d=l.substring(0,l.length-ba(a).length)));let v=y(a,l,d,c);if(typeof v=="string")return v;cf(v)&&(u||(u=[]),u.push(v))}return u?(async()=>{for(let f of u){let m=await f;if(typeof m=="string")return m}return null})():null},i=e.find(a=>!!a.allBasenames);i&&(n.allBasenames=i.allBasenames);let s=e.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return s.length&&(n.allPaths=s),n}function HW(o,r,e){if(r===!1)return ki;let t=kw(o,e);if(t===ki)return ki;if(typeof r=="boolean")return t;if(r){let n=r.when;if(typeof n=="string"){let i=(s,a,l,c)=>{if(!c||!t(s,a))return null;let d=n.replace("$(basename)",()=>l),u=c(d);return cf(u)?u.then(f=>f?o:null):u?o:null};return i.requiresSiblings=!0,i}}return t}function k0(o,r){let e=o.filter(a=>!!a.basenames);if(e.length<2)return o;let t=e.reduce((a,l)=>{let c=l.basenames;return c?a.concat(c):a},[]),n;if(r){n=[];for(let a=0,l=t.length;a<l;a++)n.push(r)}else n=e.reduce((a,l)=>{let c=l.patterns;return c?a.concat(c):a},[]);let i=function(a,l){if(typeof a!="string")return null;if(!l){let d;for(d=a.length;d>0;d--){let u=a.charCodeAt(d-1);if(u===47||u===92)break}l=a.substring(d)}let c=t.indexOf(l);return c!==-1?n[c]:null};i.basenames=t,i.patterns=n,i.allBasenames=t;let s=o.filter(a=>!a.basenames);return s.push(i),s}function Rw(o,r){return So(o,r,(e,t)=>typeof e=="string"&&typeof t=="string"?e===t:typeof e!="string"&&typeof t!="string"?e.base===t.base&&e.pattern===t.pattern:!1)}var Vl,I0,jm,Jm,kW,RW,DW,WW,LW,AW,MW,x0,P0,ki,Dw=w(()=>{zt();he();Kn();an();Lr();Se();Y();dr();Vl="**",I0="/",jm="[/\\\\]",Jm="[^/\\\\]",kW=/\//g;RW=/^\*\*\/\*\.[\w\.-]+$/,DW=/^\*\*\/([\w\.-]+)\/?$/,WW=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,LW=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,AW=/^\*\*((\/[\w\.-]+)+)\/?$/,MW=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,x0=new di(1e4),P0=function(){return!1},ki=function(){return null}});function Zm(o){return typeof o.correlationId=="number"}function D0(o){return o.recursive===!0}function eh(o){return o.map(r=>({type:r.type,resource:b.revive(r.resource),cId:r.cId}))}function W0(o){let r=new Ww;for(let e of o)r.processEvent(e);return r.coalesce()}function KW(o,r){return typeof r=="string"&&!r.startsWith(Vl)&&!bo(r)?{base:o,pattern:r}:r}function Lw(o,r,e){let t=[];for(let n of r)t.push(_0(KW(o,n),{ignoreCase:e}));return t}function L0(o,r){if(typeof r=="number")switch(o.type){case 1:return(r&4)===0;case 2:return(r&8)===0;case 0:return(r&2)===0}return!1}function A0(o){if(typeof o=="number"){let r=[];return o&4&&r.push("Added"),o&8&&r.push("Deleted"),o&2&&r.push("Updated"),r.length===0?"<all>":`[${r.join(", ")}]`}return"<none>"}var Qm,Xm,Ym,Ww,ta=w(()=>{Dw();K();Se();Y();se();je();Qm=class o extends C{constructor(e,t,n,i){super();this.onFileChanges=e;this.onLogMessage=t;this.verboseLogging=n;this.options=i;this.watcherDisposables=this._register(new er);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new te;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<o.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()}},Xm=class extends Qm{constructor(r,e,t){super(r,e,t,{type:"node.js",restartOnError:!1})}},Ym=class extends Qm{constructor(r,e,t){super(r,e,t,{type:"universal",restartOnError:!0})}};Ww=class{constructor(){this.coalesced=new Set;this.mapPathToChange=new Map}toKey(r){return ne?r.resource.fsPath:r.resource.fsPath.toLowerCase()}processEvent(r){let e=this.mapPathToChange.get(this.toKey(r)),t=!1;if(e){let n=e.type,i=r.type;e.resource.fsPath!==r.resource.fsPath&&(r.type===2||r.type===1)?t=!0:n===1&&i===2?(this.mapPathToChange.delete(this.toKey(r)),this.coalesced.delete(e)):n===2&&i===1?e.type=0:n===1&&i===0||(e.type=i)}else t=!0;t&&(this.coalesced.add(r),this.mapPathToChange.set(this.toKey(r),r))}coalesce(){let r=[],e=[];return Array.from(this.coalesced).filter(t=>t.type!==2?(r.push(t),!1):!0).sort((t,n)=>t.resource.fsPath.length-n.resource.fsPath.length).filter(t=>e.some(n=>qx(t.resource.fsPath,n,!ne))?!1:(e.push(t.resource.fsPath),!0)).concat(r)}}});var Mw,M0=w(()=>{nt();Ro();Ve();Q();K();qa();Mt();je();ta();Mw="localFilesystem"});async function rh(o,r,e,t,n,i){let s;try{await $W(o,r,e,t,n,i)}catch(a){s=a}finally{s&&n.errorTransformer&&(s=n.errorTransformer(s)),typeof s<"u"&&e.error(s),e.end()}}async function $W(o,r,e,t,n,i){Ow(i);let s=await o.open(r,{create:!1});try{Ow(i);let a=0,l=0,c=n&&typeof n.length=="number"?n.length:void 0,d=H.alloc(Math.min(n.bufferSize,typeof c=="number"?c:n.bufferSize)),u=n&&typeof n.position=="number"?n.position:0,f=0;do l=await o.read(s,u,d.buffer,f,d.byteLength-f),u+=l,f+=l,a+=l,typeof c=="number"&&(c-=l),f===d.byteLength&&(await e.write(t(d)),d=H.alloc(Math.min(n.bufferSize,typeof c=="number"?c:n.bufferSize)),f=0);while(l>0&&(typeof c!="number"||c>0)&&Ow(i)&&qW(a,n));if(f>0){let m=f;typeof c=="number"&&(m=Math.min(f,c)),e.write(t(d.slice(0,m)))}}catch(a){throw to(a)}finally{await o.close(s)}}function Ow(o){if(o.isCancellationRequested)throw ci();return!0}function qW(o,r){if(typeof r?.limits?.size=="number"&&o>r.limits.size)throw Gr(h(2097,null),"EntryTooLarge");return!0}var Fw=w(()=>{nt();Ve();Ce();je()});var nh,O0=w(()=>{zt();he();Ve();Q();an();K();Se();ta();re();nh=class extends C{constructor(e,t){super();this.logService=e;this.options=t;this._onDidChangeFile=this._register(new x);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidWatchError=this._register(new x);this.onDidWatchError=this._onDidWatchError.event;this.universalWatchRequests=[];this.universalWatchRequestDelayer=this._register(new Pr(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new Pr(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 n=this.toWatchRequest(e,t),i=rv(this.universalWatchRequests,n);return this.refreshUniversalWatchers(),j(()=>{i(),this.refreshUniversalWatchers()})}toWatchRequest(e,t){let n={path:this.toWatchPath(e),excludes:t.excludes,includes:t.includes,recursive:t.recursive,filter:t.filter,correlationId:t.correlationId};if(D0(n)){let i=this.options?.watcher?.recursive?.usePolling;i===!0?n.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(i)&&i.includes(n.path)&&(n.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3)}return n}refreshUniversalWatchers(){this.universalWatchRequestDelayer.trigger(()=>this.doRefreshUniversalWatchers(),this.getRefreshWatchersDelay(this.universalWatchRequests.length)).catch(e=>rt(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(eh(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 n={path:this.toWatchPath(e),excludes:t.excludes,includes:t.includes,recursive:!1,filter:t.filter,correlationId:t.correlationId},i=rv(this.nonRecursiveWatchRequests,n);return this.refreshNonRecursiveWatchers(),j(()=>{i(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>rt(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(eh(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 kt(e.fsPath)}toWatchPath(e){let t=this.toFilePath(e);return Iv(t)}}});function F0(o){let r=o;return r&&typeof r.type=="string"&&typeof r.severity=="string"}function zW(o){let r=[],e;try{let t=JSON.parse(o.arguments),n=t[t.length-1];n&&n.__$stack&&(t.pop(),e=n.__$stack),r.push(...t)}catch{r.push("Unable to log remote console arguments",o.arguments)}return{args:r,stack:e}}function GW(o){if(!o)return o;let r=o.indexOf(`
`);return r===-1?o:o.substring(0,r)}function U0(o,r){let{args:e,stack:t}=zW(o),n=typeof e[0]=="string"&&e.length===1,i=GW(t);i&&(i=`(${i.trim()})`);let s=[];if(typeof e[0]=="string"?i&&n?s=[`%c[${r}] %c${e[0]} %c${i}`,Hl("blue"),Hl(""),Hl("grey")]:s=[`%c[${r}] %c${e[0]}`,Hl("blue"),Hl(""),...e.slice(1)]:s=[`%c[${r}]%`,Hl("blue"),...e],i&&!n&&s.push(i),typeof console[o.severity]!="function")throw new Error("Unknown console method");console[o.severity].apply(console,s)}function Hl(o){return`color: ${o}`}var N0=w(()=>{se()});import{fork as jW}from"child_process";var ih,B0=w(()=>{he();nt();St();N0();Ve();Q();K();yn();Ul();Pu();vi();ih=class{constructor(r,e){this.modulePath=r;this.options=e;this.activeRequests=new Set;this.channels=new Map;this._onDidProcessExit=new x;this.onDidProcessExit=this._onDidProcessExit.event;let t=e.timeout||6e4;this.disposeDelayer=new _s(t),this.child=null,this._client=null}getChannel(r){let e=this;return{call(t,n,i){return e.requestPromise(r,t,n,i)},listen(t,n){return e.requestEvent(r,t,n)}}}requestPromise(r,e,t,n=be.None){if(!this.disposeDelayer)return Promise.reject(new Error("disposed"));if(n.isCancellationRequested)return Promise.reject(ci());this.disposeDelayer.cancel();let i=this.getCachedChannel(r),s=zn(c=>i.call(e,t,c)),a=n.onCancellationRequested(()=>s.cancel()),l=j(()=>s.cancel());return this.activeRequests.add(l),s.finally(()=>{a.dispose(),this.activeRequests.delete(l),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}),s}requestEvent(r,e,t){if(!this.disposeDelayer)return E.None;this.disposeDelayer.cancel();let n,i=new x({onWillAddFirstListener:()=>{n=this.getCachedChannel(r).listen(e,t)(i.fire,i),this.activeRequests.add(n)},onDidRemoveLastListener:()=>{this.activeRequests.delete(n),n.dispose(),this.activeRequests.size===0&&this.disposeDelayer&&this.disposeDelayer.trigger(()=>this.disposeClient())}});return i.event}get client(){if(!this._client){let r=this.options.args||[],e=Object.create(null);e.env={...gr(process.env),VSCODE_PARENT_PID:String(process.pid)},this.options.env&&(e.env={...e.env,...this.options.env}),this.options.freshExecArgv&&(e.execArgv=[]),typeof this.options.debug=="number"&&(e.execArgv=["--nolazy","--inspect="+this.options.debug]),typeof this.options.debugBrk=="number"&&(e.execArgv=["--nolazy","--inspect-brk="+this.options.debugBrk]),e.execArgv===void 0&&(e.execArgv=process.execArgv.filter(u=>!/^--inspect(-brk)?=/.test(u)).filter(u=>!u.startsWith("--vscode-"))),Am(e.env),this.child=jW(this.modulePath,r,e);let t=new x,i=E.fromNodeEventEmitter(this.child,"message",u=>u)(u=>{if(F0(u)){U0(u,`IPC Library: ${this.options.serverName}`);return}t.fire(H.wrap(Buffer.from(u,"base64")))}),s=this.options.useQueue?a0(this.child):this.child,a=u=>this.child?.connected&&s.send(u.buffer.toString("base64")),l=t.event,c={send:a,onMessage:l};this._client=new Ls(c);let d=()=>this.disposeClient();process.once("exit",d),this.child.on("error",u=>console.warn('IPC "'+this.options.serverName+'" errored with '+u)),this.child.on("exit",(u,f)=>{process.removeListener("exit",d),i.dispose(),this.activeRequests.forEach(m=>pt(m)),this.activeRequests.clear(),u!==0&&f!=="SIGTERM"&&console.warn('IPC "'+this.options.serverName+'" crashed with exit code '+u+" and signal "+f),this.disposeDelayer?.cancel(),this.disposeClient(),this._onDidProcessExit.fire({code:u,signal:f})})}return this._client}getCachedChannel(r){let e=this.channels.get(r);return e||(e=this.client.getChannel(r),this.channels.set(r,e)),e}disposeClient(){this._client&&(this.child&&(this.child.kill(),this.child=null),this._client=null,this.channels.clear())}dispose(){this._onDidProcessExit.dispose(),this.disposeDelayer?.cancel(),this.disposeDelayer=void 0,this.disposeClient(),this.activeRequests.clear()}}});var oh,V0=w(()=>{ze();vi();B0();ta();oh=class extends Ym{constructor(r,e,t){super(r,e,t),this.init()}createWatcher(r){let e=r.add(new ih(et.asFileUri("bootstrap-fork").fsPath,{serverName:"File Watcher",args:["--type=fileWatcher"],env:{VSCODE_ESM_ENTRYPOINT:"vs/platform/files/node/watcher/watcherMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true"}}));return r.add(e.onDidProcessExit(({code:t,signal:n})=>this.onError(`terminated by itself with code ${t}, signal: ${n} (ETERM)`))),He.toService(ax(e.getChannel("watcher")))}}});import{watchFile as JW,unwatchFile as QW}from"fs";var sh,H0=w(()=>{K();ta();Q();je();se();he();yi();Ve();sh=class extends C{constructor(){super();this._onDidChangeFile=this._register(new x);this.onDidChangeFile=this._onDidChangeFile.event;this._onDidLogMessage=this._register(new x);this.onDidLogMessage=this._onDidLogMessage.event;this._onDidWatchFail=this._register(new x);this.onDidWatchFail=this._onDidWatchFail.event;this.correlatedWatchRequests=new Map;this.nonCorrelatedWatchRequests=new Map;this.suspendedWatchRequests=this._register(new cr);this.suspendedWatchRequestsWithPolling=new Set;this.updateWatchersDelayer=this._register(new Pr(this.getUpdateWatchersDelay()));this.suspendedWatchRequestPollingInterval=5007;this.joinWatch=new Gt;this.verboseLogging=!1;this._register(this.onDidWatchFail(e=>this.suspendWatchRequest({id:this.computeId(e),correlationId:this.isCorrelated(e)?e.correlationId:void 0,path:e.path})))}isCorrelated(e){return Zm(e)}computeId(e){return this.isCorrelated(e)?e.correlationId:rr(e)}async watch(e){this.joinWatch.isSettled||this.joinWatch.complete(),this.joinWatch=new Gt;try{this.correlatedWatchRequests.clear(),this.nonCorrelatedWatchRequests.clear();for(let t of e)this.isCorrelated(t)?this.correlatedWatchRequests.set(t.correlationId,t):this.nonCorrelatedWatchRequests.set(this.computeId(t),t);for(let[t]of this.suspendedWatchRequests)!this.nonCorrelatedWatchRequests.has(t)&&!this.correlatedWatchRequests.has(t)&&(this.suspendedWatchRequests.deleteAndDispose(t),this.suspendedWatchRequestsWithPolling.delete(t));return await this.updateWatchers(!1)}finally{this.joinWatch.complete()}}updateWatchers(e){let t=[];for(let[n,i]of[...this.nonCorrelatedWatchRequests,...this.correlatedWatchRequests])this.suspendedWatchRequests.has(n)||t.push(i);return this.updateWatchersDelayer.trigger(()=>this.doWatch(t),e?this.getUpdateWatchersDelay():0).catch(n=>rt(n))}getUpdateWatchersDelay(){return 800}isSuspended(e){let t=this.computeId(e);return this.suspendedWatchRequestsWithPolling.has(t)?"polling":this.suspendedWatchRequests.has(t)}async suspendWatchRequest(e){if(this.suspendedWatchRequests.has(e.id))return;let t=new te;this.suspendedWatchRequests.set(e.id,t),await this.joinWatch.p,!t.isDisposed&&(this.monitorSuspendedWatchRequest(e,t),this.updateWatchers(!0))}resumeWatchRequest(e){this.suspendedWatchRequests.deleteAndDispose(e.id),this.suspendedWatchRequestsWithPolling.delete(e.id),this.updateWatchers(!1)}monitorSuspendedWatchRequest(e,t){this.doMonitorWithExistingWatcher(e,t)?(this.trace(`reusing an existing recursive watcher to monitor ${e.path}`),this.suspendedWatchRequestsWithPolling.delete(e.id)):(this.doMonitorWithNodeJS(e,t),this.suspendedWatchRequestsWithPolling.add(e.id))}doMonitorWithExistingWatcher(e,t){let n=this.recursiveWatcher?.subscribe(e.path,(i,s)=>{t.isDisposed||(i?this.monitorSuspendedWatchRequest(e,t):s?.type===1&&this.onMonitoredPathAdded(e))});return n?(t.add(n),!0):!1}doMonitorWithNodeJS(e,t){let n=!1,i=(s,a)=>{if(t.isDisposed)return;let l=this.isPathNotFound(s),c=this.isPathNotFound(a),d=n;n=l,!l&&(c||d)&&this.onMonitoredPathAdded(e)};this.trace(`starting fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{JW(e.path,{persistent:!1,interval:this.suspendedWatchRequestPollingInterval},i)}catch(s){this.warn(`fs.watchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}t.add(j(()=>{this.trace(`stopping fs.watchFile() on ${e.path} (correlationId: ${e.correlationId})`);try{QW(e.path,i)}catch(s){this.warn(`fs.unwatchFile() failed with error ${s} on path ${e.path} (correlationId: ${e.correlationId})`)}}))}onMonitoredPathAdded(e){this.trace(`detected ${e.path} exists again, resuming watcher (correlationId: ${e.correlationId})`);let t={resource:b.file(e.path),type:1,cId:e.correlationId};this._onDidChangeFile.fire([t]),this.traceEvent(t,e),this.resumeWatchRequest(e)}isPathNotFound(e){return e.ctimeMs===0&&e.ino===0}async stop(){this.suspendedWatchRequests.clearAndDisposeAll(),this.suspendedWatchRequestsWithPolling.clear()}traceEvent(e,t){if(this.verboseLogging){let n=` >> normalized ${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`;this.traceWithCorrelation(n,t)}}traceWithCorrelation(e,t){this.verboseLogging&&this.trace(`${e}${typeof t.correlationId=="number"?` <${t.correlationId}> `:""}`)}requestToString(e){return`${e.path} (excludes: ${e.excludes.length>0?e.excludes:"<none>"}, includes: ${e.includes&&e.includes.length>0?JSON.stringify(e.includes):"<all>"}, filter: ${A0(e.filter)}, correlationId: ${typeof e.correlationId=="number"?e.correlationId:"<none>"})`}async setVerboseLogging(e){this.verboseLogging=e}}});import{watch as XW,promises as YW}from"fs";var ah,K0=w(()=>{he();St();an();K();wd();Se();Y();yt();se();jt();je();ta();xo();ah=class o extends C{constructor(e,t,n,i,s,a){super();this.request=e;this.recursiveWatcher=t;this.onDidFilesChange=n;this.onDidWatchFail=i;this.onLogMessage=s;this.verboseLogging=a;this.throttledFileChangesEmitter=this._register(new Na({maxWorkChunkSize:100,throttleDelay:200,maxBufferedWork:1e4},e=>this.onDidFilesChange(e)));this.fileChangesAggregator=this._register(new af(e=>this.handleFileChanges(e),o.FILE_CHANGES_HANDLER_DELAY));this.cts=new qe;this.realPath=new xr(async()=>{let e=this.request.path;try{e=await q.realpath(this.request.path),this.request.path!==e&&this.trace(`correcting a path to watch that seems to be a symbolic link (original: ${this.request.path}, real: ${e})`)}catch{}return e});this._isReusingRecursiveWatcher=!1;this.didFail=!1;let l=!ne;this.excludes=Lw(this.request.path,this.request.excludes,l),this.includes=this.request.includes?Lw(this.request.path,this.request.includes,l):void 0,this.filter=Zm(this.request)?this.request.filter:void 0,this.ready=this.watch()}static{this.FILE_DELETE_HANDLER_DELAY=100}static{this.FILE_CHANGES_HANDLER_DELAY=75}get isReusingRecursiveWatcher(){return this._isReusingRecursiveWatcher}get failed(){return this.didFail}async watch(){try{let e=await YW.stat(this.request.path);if(this.cts.token.isCancellationRequested)return;this._register(await this.doWatch(e.isDirectory()))}catch(e){e.code!=="ENOENT"?this.error(e):this.trace(`ignoring a path for watching who's stat info failed to resolve: ${this.request.path} (error: ${e})`),this.notifyWatchFailed()}}notifyWatchFailed(){this.didFail=!0,this.onDidWatchFail?.()}async doWatch(e){let t=new te;return this.doWatchWithExistingWatcher(e,t)?(this.trace(`reusing an existing recursive watcher for ${this.request.path}`),this._isReusingRecursiveWatcher=!0):(this._isReusingRecursiveWatcher=!1,await this.doWatchWithNodeJS(e,t)),t}doWatchWithExistingWatcher(e,t){if(e)return!1;let n=b.file(this.request.path),i=this.recursiveWatcher?.subscribe(this.request.path,async(s,a)=>{t.isDisposed||(s?await WS(this.doWatch(e),t):a&&(typeof a.cId=="number"||typeof this.request.correlationId=="number")&&this.onFileChange({resource:n,type:a.type,cId:this.request.correlationId},!0))});return i?(t.add(i),!0):!1}async doWatchWithNodeJS(e,t){let n=await this.realPath.value;if(this.cts.token.isCancellationRequested)return;if(V&&$i(n,"/Volumes/",!0)){this.error(`Refusing to watch ${n} for changes using fs.watch() for possibly being a network share where watching is unreliable and unstable.`);return}let i=new qe(this.cts.token);t.add(j(()=>i.dispose(!0)));let s=new te;t.add(s);try{let a=b.file(this.request.path),l=ye(n),c=XW(n);s.add(j(()=>{c.removeAllListeners(),c.close()})),this.trace(`Started watching: '${n}'`);let d=new Set;if(e)try{for(let f of await q.readdir(n))d.add(f)}catch(f){this.error(f)}if(i.token.isCancellationRequested)return;let u=new Map;s.add(j(()=>{for(let[,f]of u)f.dispose();u.clear()})),c.on("error",(f,m)=>{i.token.isCancellationRequested||(this.error(`Failed to watch ${n} for changes using fs.watch() (${f}, ${m})`),this.notifyWatchFailed())}),c.on("change",(f,m)=>{if(i.token.isCancellationRequested)return;this.verboseLogging&&this.traceWithCorrelation(`[raw] ["${f}"] ${m}`);let y="";if(m&&(y=m.toString(),V&&(y=hi(y))),!(!y||f!=="change"&&f!=="rename"))if(e)if(f==="rename"){u.get(y)?.dispose();let v=setTimeout(async()=>{if(u.delete(y),Co(y,l,!ne)&&!await q.exists(n)){this.onWatchedPathDeleted(a);return}if(i.token.isCancellationRequested)return;let S=await this.existsChildStrictCase(U(n,y));if(i.token.isCancellationRequested)return;let I;S?d.has(y)?I=0:(I=1,d.add(y)):(d.delete(y),I=2),this.onFileChange({resource:fe(a,y),type:I,cId:this.request.correlationId})},o.FILE_DELETE_HANDLER_DELAY);u.set(y,j(()=>clearTimeout(v)))}else{let v;d.has(y)?v=0:(v=1,d.add(y)),this.onFileChange({resource:fe(a,y),type:v,cId:this.request.correlationId})}else if(f==="rename"||!Co(y,l,!ne)){let v=setTimeout(async()=>{let S=await q.exists(n);i.token.isCancellationRequested||(S?(this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0),s.add(await this.doWatch(!1))):this.onWatchedPathDeleted(a))},o.FILE_DELETE_HANDLER_DELAY);s.clear(),s.add(j(()=>clearTimeout(v)))}else this.onFileChange({resource:a,type:0,cId:this.request.correlationId},!0)})}catch(a){if(i.token.isCancellationRequested)return;this.error(`Failed to watch ${n} for changes using fs.watch() (${a.toString()})`),this.notifyWatchFailed()}}onWatchedPathDeleted(e){this.warn("Watcher shutdown because watched path got deleted"),this.onFileChange({resource:e,type:2,cId:this.request.correlationId},!0),this.fileChangesAggregator.flush(),this.notifyWatchFailed()}onFileChange(e,t=!1){this.cts.token.isCancellationRequested||(this.verboseLogging&&this.traceWithCorrelation(`${e.type===1?"[ADDED]":e.type===2?"[DELETED]":"[CHANGED]"} ${e.resource.fsPath}`),!t&&this.excludes.some(n=>n(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (excluded) ${e.resource.fsPath}`):!t&&this.includes&&this.includes.length>0&&!this.includes.some(n=>n(e.resource.fsPath))?this.verboseLogging&&this.traceWithCorrelation(` >> ignored (not included) ${e.resource.fsPath}`):this.fileChangesAggregator.work(e))}handleFileChanges(e){let t=W0(e),n=[];for(let s of t){if(L0(s,this.filter)){this.verboseLogging&&this.traceWithCorrelation(` >> ignored (filtered) ${s.resource.fsPath}`);continue}n.push(s)}if(n.length===0)return;if(this.verboseLogging)for(let s of n)this.traceWithCorrelation(` >> normalized ${s.type===1?"[ADDED]":s.type===2?"[DELETED]":"[CHANGED]"} ${s.resource.fsPath}`);this.throttledFileChangesEmitter.work(n)?this.throttledFileChangesEmitter.pending>0&&this.trace(`started throttling events due to large amount of file change events at once (pending: ${this.throttledFileChangesEmitter.pending}, most recent change: ${n[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`):this.warn(`started ignoring events due to too many file change events at once (incoming: ${n.length}, most recent change: ${n[0].resource.fsPath}). Use 'files.watcherExclude' setting to exclude folders with lots of changing files (e.g. compilation output).`)}async existsChildStrictCase(e){if(ne)return q.exists(e);try{let t=ye(e);return(await q.readdir($e(e))).some(i=>i===t)}catch(t){return this.trace(t),!1}}setVerboseLogging(e){this.verboseLogging=e}error(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"error",message:`[File Watcher (node.js)] ${e}`})}warn(e){this.cts.token.isCancellationRequested||this.onLogMessage?.({type:"warn",message:`[File Watcher (node.js)] ${e}`})}trace(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.onLogMessage?.({type:"trace",message:`[File Watcher (node.js)] ${e}`})}traceWithCorrelation(e){!this.cts.token.isCancellationRequested&&this.verboseLogging&&this.trace(`${e}${typeof this.request.correlationId=="number"?` <${this.request.correlationId}> `:""}`)}dispose(){this.cts.dispose(!0),super.dispose()}}});var lh,$0=w(()=>{Q();Dw();H0();Y();K0();he();K();lh=class extends sh{constructor(e){super();this.recursiveWatcher=e;this.onDidError=E.None;this._watchers=new Map;this.worker=this._register(new er)}get watchers(){return this._watchers.values()}async doWatch(e){e=this.removeDuplicateRequests(e);let t=[],n=new Set(Array.from(this.watchers));for(let i of e){let s=this._watchers.get(this.requestToWatcherKey(i));s&&Rw(s.request.excludes,i.excludes)&&Rw(s.request.includes,i.includes)?n.delete(s):t.push(i)}t.length&&this.trace(`Request to start watching: ${t.map(i=>this.requestToString(i)).join(",")}`),n.size&&this.trace(`Request to stop watching: ${Array.from(n).map(i=>this.requestToString(i.request)).join(",")}`),this.worker.clear();for(let i of n)this.stopWatching(i);this.createWatchWorker().work(t)}createWatchWorker(){return this.worker.value=new Na({maxWorkChunkSize:100,throttleDelay:100,maxBufferedWork:Number.MAX_VALUE},e=>{for(let t of e)this.startWatching(t)}),this.worker.value}requestToWatcherKey(e){return typeof e.correlationId=="number"?e.correlationId:this.pathToWatcherKey(e.path)}pathToWatcherKey(e){return ne?e:e.toLowerCase()}startWatching(e){let t=new ah(e,this.recursiveWatcher,i=>this._onDidChangeFile.fire(i),()=>this._onDidWatchFail.fire(e),i=>this._onDidLogMessage.fire(i),this.verboseLogging),n={request:e,instance:t};this._watchers.set(this.requestToWatcherKey(e),n)}async stop(){await super.stop();for(let e of this.watchers)this.stopWatching(e)}stopWatching(e){this.trace("stopping file watcher",e),this._watchers.delete(this.requestToWatcherKey(e.request)),e.instance.dispose()}removeDuplicateRequests(e){let t=new Map;for(let n of e){let i=t.get(n.correlationId);i||(i=new Map,t.set(n.correlationId,i));let s=this.pathToWatcherKey(n.path);i.has(s)&&this.trace(`ignoring a request for watching who's path is already watched: ${this.requestToString(n)}`),i.set(s,n)}return Array.from(t.values()).flatMap(n=>Array.from(n.values()))}async setVerboseLogging(e){super.setVerboseLogging(e);for(let t of this.watchers)t.instance.setVerboseLogging(e)}trace(e,t){this.verboseLogging&&this._onDidLogMessage.fire({type:"trace",message:this.toMessage(e,t)})}warn(e){this._onDidLogMessage.fire({type:"warn",message:this.toMessage(e)})}toMessage(e,t){return t?`[File Watcher (node.js)] ${e} (${this.requestToString(t.request)})`:`[File Watcher (node.js)] ${e}`}}});var ch,q0=w(()=>{ta();$0();ch=class extends Xm{constructor(r,e,t){super(r,e,t),this.init()}createWatcher(r){return r.add(new lh(void 0))}}});import{constants as Uw,promises as ra}from"fs";var ts,dh=w(()=>{he();Lr();nt();Q();an();K();Se();Y();yt();qa();jt();Ce();je();Fw();O0();V0();q0();ts=class o extends nh{constructor(){super(...arguments);this.onDidChangeCapabilities=E.None;this.resourceLocks=new gt(e=>Ge.getComparisonKey(e));this.mapHandleToPos=new Map;this.mapHandleToLock=new Map;this.writeHandles=new Map}static{this.TRACE_LOG_RESOURCE_LOCKS=!1}get capabilities(){return this._capabilities||(this._capabilities=1040414,ne&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let{stat:t,symbolicLink:n}=await Yt.stat(this.toFilePath(e)),i;return(t.mode&128)===0&&(i=2),(t.mode&Uw.S_IXUSR||t.mode&Uw.S_IXGRP||t.mode&Uw.S_IXOTH)&&(i=(i??0)|4),{type:this.toType(t,n),ctime:t.birthtime.getTime(),mtime:t.mtime.getTime(),size:t.size,permissions:i}}catch(t){throw this.toFileSystemProviderError(t)}}async statIgnoreError(e){try{return await this.stat(e)}catch{return}}async realpath(e){let t=this.toFilePath(e);return q.realpath(t)}async readdir(e){try{let t=await q.readdir(this.toFilePath(e),{withFileTypes:!0}),n=[];return await Promise.all(t.map(async i=>{try{let s;i.isSymbolicLink()?s=(await this.stat(fe(e,i.name))).type:s=this.toType(i),n.push([i.name,s])}catch(s){this.logService.trace(s)}})),n}catch(t){throw this.toFileSystemProviderError(t)}}toType(e,t){let n;return t?.dangling?n=0:e.isFile()?n=1:e.isDirectory()?n=2:n=0,t&&(n|=64),n}async createResourceLock(e){let t=this.toFilePath(e);this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - request to acquire resource lock (${t})`);let n;for(;n=this.resourceLocks.get(e);)this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - waiting for resource lock to be released (${t})`),await n.wait();let i=new mi;return this.resourceLocks.set(e,i),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - new resource lock created (${t})`),j(()=>{this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock dispose() (${t})`),this.resourceLocks.get(e)===i&&(this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock removed from resource-lock map (${t})`),this.resourceLocks.delete(e)),this.traceLock(`[Disk FileSystemProvider]: createResourceLock() - resource lock barrier open() (${t})`),i.open()})}async readFile(e,t){let n;try{t?.atomic&&(this.traceLock(`[Disk FileSystemProvider]: atomic read operation started (${this.toFilePath(e)})`),n=await this.createResourceLock(e));let i=this.toFilePath(e);return await ra.readFile(i)}catch(i){throw this.toFileSystemProviderError(i)}finally{n?.dispose()}}traceLock(e){o.TRACE_LOG_RESOURCE_LOCKS&&this.logService.trace(e)}readFileStream(e,t,n){let i=Do(s=>H.concat(s.map(a=>H.wrap(a))).buffer);return rh(this,e,i,s=>s.buffer,{...t,bufferSize:256*1024},n),i}async writeFile(e,t,n){return n?.atomic!==!1&&n?.atomic?.postfix&&await this.canWriteFileAtomic(e)?this.doWriteFileAtomic(e,fe(s1(e),`${Kr(e)}${n.atomic.postfix}`),t,n):this.doWriteFile(e,t,n)}async canWriteFileAtomic(e){try{let t=this.toFilePath(e),{symbolicLink:n}=await Yt.stat(t);if(n)return!1}catch{}return!0}async doWriteFileAtomic(e,t,n,i){let s=new te;try{s.add(await this.createResourceLock(e)),s.add(await this.createResourceLock(t)),await this.doWriteFile(t,n,{...i,create:!0,overwrite:!0},!0);try{await this.rename(t,e,{overwrite:!0})}catch(a){try{await this.delete(t,{recursive:!1,useTrash:!1,atomic:!1})}catch{}throw a}}finally{s.dispose()}}async doWriteFile(e,t,n,i){let s;try{let a=this.toFilePath(e);if(!n.create||!n.overwrite){if(await q.exists(a)){if(!n.overwrite)throw Gr(h(2102,null),"EntryExists")}else if(!n.create)throw Gr(h(2105,null),"EntryNotFound")}s=await this.open(e,{create:!0,append:n.append,unlock:n.unlock},i),await this.write(s,0,t,0,t.byteLength)}catch(a){throw await this.toFileSystemProviderWriteError(e,a)}finally{typeof s=="number"&&await this.close(s)}}static{this.canFlush=!0}static configureFlushOnWrite(e){o.canFlush=e}async open(e,t,n){let i=this.toFilePath(e),s;Bs(t)&&!n&&(s=await this.createResourceLock(e));let a;try{if(Bs(t)&&t.unlock)try{let{stat:l}=await Yt.stat(i);l.mode&128||await ra.chmod(i,l.mode|128)}catch(l){l.code!=="ENOENT"&&this.logService.trace(l)}if(M&&Bs(t)&&!t.append)try{a=await q.open(i,"r+"),await q.ftruncate(a,0)}catch(l){if(l.code!=="ENOENT"&&this.logService.trace(l),typeof a=="number"){try{await q.close(a)}catch(c){this.logService.trace(c)}a=void 0}}typeof a!="number"&&(a=await q.open(i,Bs(t)?t.append?"a":"w":"r"))}catch(l){throw s?.dispose(),Bs(t)?await this.toFileSystemProviderWriteError(e,l):this.toFileSystemProviderError(l)}if(this.mapHandleToPos.set(a,0),Bs(t)&&this.writeHandles.set(a,e),s){let l=this.mapHandleToLock.get(a);this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${a} (${i})`),this.mapHandleToLock.set(a,s),l&&(this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${a} (${i})`),l.dispose())}return a}async close(e){let t=this.mapHandleToLock.get(e);try{if(this.mapHandleToPos.delete(e),this.writeHandles.delete(e)&&o.canFlush)try{await q.fdatasync(e)}catch(n){o.configureFlushOnWrite(!1),this.logService.error(n)}return await q.close(e)}catch(n){throw this.toFileSystemProviderError(n)}finally{t&&(this.mapHandleToLock.get(e)===t&&(this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${e}`),this.mapHandleToLock.delete(e)),this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${e}`),t.dispose())}}async read(e,t,n,i,s){let a=this.normalizePos(e,t),l=null;try{l=(await q.read(e,n,i,s,a)).bytesRead}catch(c){throw this.toFileSystemProviderError(c)}finally{this.updatePos(e,a,l)}return l}normalizePos(e,t){return t===this.mapHandleToPos.get(e)?null:t}updatePos(e,t,n){let i=this.mapHandleToPos.get(e);typeof i=="number"&&(typeof t=="number"||(typeof n=="number"?this.mapHandleToPos.set(e,i+n):this.mapHandleToPos.delete(e)))}async write(e,t,n,i,s){return m1(()=>this.doWrite(e,t,n,i,s),100,3)}async doWrite(e,t,n,i,s){let a=this.normalizePos(e,t),l=null;try{l=(await q.write(e,n,i,s,a)).bytesWritten}catch(c){throw await this.toFileSystemProviderWriteError(this.writeHandles.get(e),c)}finally{this.updatePos(e,a,l)}return l}async mkdir(e){try{await ra.mkdir(this.toFilePath(e))}catch(t){throw this.toFileSystemProviderError(t)}}async delete(e,t){try{let n=this.toFilePath(e);if(t.recursive){let i;t?.atomic!==!1&&t.atomic.postfix&&(i=U($e(n),`${ye(n)}${t.atomic.postfix}`)),await q.rm(n,1,i)}else try{await ra.unlink(n)}catch(i){if(i.code==="EPERM"||i.code==="EISDIR"){let s=!1;try{let{stat:a,symbolicLink:l}=await Yt.stat(n);s=a.isDirectory()&&!l}catch{}if(s)await ra.rmdir(n);else throw i}else throw i}}catch(n){throw this.toFileSystemProviderError(n)}}async rename(e,t,n){let i=this.toFilePath(e),s=this.toFilePath(t);if(i!==s)try{await this.validateMoveCopy(e,t,"move",n.overwrite),await q.rename(i,s)}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(h(2106,null,ye(i),ye($e(s)),a.toString()))),this.toFileSystemProviderError(a)}}async copy(e,t,n){let i=this.toFilePath(e),s=this.toFilePath(t);if(i!==s)try{await this.validateMoveCopy(e,t,"copy",n.overwrite),await q.copy(i,s,{preserveSymlinks:!0})}catch(a){throw(a.code==="EINVAL"||a.code==="EBUSY"||a.code==="ENAMETOOLONG")&&(a=new Error(h(2100,null,ye(i),ye($e(s)),a.toString()))),this.toFileSystemProviderError(a)}}async validateMoveCopy(e,t,n,i){let s=this.toFilePath(e),a=this.toFilePath(t),l=!1;if(this.capabilities&1024||(l=Co(s,a,!0)),l){if(n==="copy")throw Gr(h(2101,null),"EntryExists");if(n==="move")return}let d=await this.statIgnoreError(e);if(!d)throw Gr(h(2104,null),"EntryNotFound");let u=await this.statIgnoreError(t);if(u){if(!i)throw Gr(h(2103,null),"EntryExists");(d.type&1)!==0&&(u.type&1)!==0||await this.delete(t,{recursive:!0,useTrash:!1,atomic:!1})}}async cloneFile(e,t){return this.doCloneFile(e,t,!1)}async doCloneFile(e,t,n){let i=this.toFilePath(e),s=this.toFilePath(t),a=!!(this.capabilities&1024);if(Co(i,s,!a))return;let l=new te;try{l.add(await this.createResourceLock(e)),l.add(await this.createResourceLock(t)),n&&await ra.mkdir($e(s),{recursive:!0}),await ra.copyFile(i,s)}catch(c){if(c.code==="ENOENT"&&!n)return this.doCloneFile(e,t,!0);throw this.toFileSystemProviderError(c)}finally{l.dispose()}}createUniversalWatcher(e,t,n){return new oh(i=>e(i),i=>t(i),n)}createNonRecursiveWatcher(e,t,n){return new ch(i=>e(i),i=>t(i),n)}toFileSystemProviderError(e){if(e instanceof sl)return e;let t=e,n;switch(e.code){case"ENOENT":n="EntryNotFound";break;case"EISDIR":n="EntryIsADirectory";break;case"ENOTDIR":n="EntryNotADirectory";break;case"EEXIST":n="EntryExists";break;case"EPERM":case"EACCES":n="NoPermissions";break;case"ERR_UNC_HOST_NOT_ALLOWED":t=`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`,n="Unknown";break;default:n="Unknown"}return Gr(t,n)}async toFileSystemProviderWriteError(e,t){let n=this.toFileSystemProviderError(t);if(e&&n.code==="NoPermissions")try{let{stat:i}=await Yt.stat(this.toFilePath(e));i.mode&128||(n=Gr(t,"EntryWriteLocked"))}catch(i){this.logService.trace(i)}return n}}});var uh,ph,G0=w(()=>{Q();dh();K();nt();qa();St();uh=class extends C{constructor(e,t){super();this.provider=e;this.logService=t;this.sessionToWatcher=new Map;this.watchRequests=new Map}call(e,t,n){let i=this.getUriTransformer(e);switch(t){case"stat":return this.stat(i,n[0]);case"realpath":return this.realpath(i,n[0]);case"readdir":return this.readdir(i,n[0]);case"open":return this.open(i,n[0],n[1]);case"close":return this.close(n[0]);case"read":return this.read(n[0],n[1],n[2]);case"readFile":return this.readFile(i,n[0],n[1]);case"write":return this.write(n[0],n[1],n[2],n[3],n[4]);case"writeFile":return this.writeFile(i,n[0],n[1],n[2]);case"rename":return this.rename(i,n[0],n[1],n[2]);case"copy":return this.copy(i,n[0],n[1],n[2]);case"cloneFile":return this.cloneFile(i,n[0],n[1]);case"mkdir":return this.mkdir(i,n[0]);case"delete":return this.delete(i,n[0],n[1]);case"watch":return this.watch(i,n[0],n[1],n[2],n[3]);case"unwatch":return this.unwatch(n[0],n[1])}throw new Error(`IPC Command ${t} not found`)}listen(e,t,n){let i=this.getUriTransformer(e);switch(t){case"fileChange":return this.onFileChange(i,n[0]);case"readFileStream":return this.onReadFileStream(i,n[0],n[1])}throw new Error(`Unknown event ${t}`)}stat(e,t){let n=this.transformIncoming(e,t,!0);return this.provider.stat(n)}realpath(e,t){let n=this.transformIncoming(e,t,!0);return this.provider.realpath(n)}readdir(e,t){let n=this.transformIncoming(e,t);return this.provider.readdir(n)}async readFile(e,t,n){let i=this.transformIncoming(e,t,!0),s=await this.provider.readFile(i,n);return H.wrap(s)}onReadFileStream(e,t,n){let i=this.transformIncoming(e,t,!0),s=new qe,a=new x({onDidRemoveLastListener:()=>{s.cancel()}}),l=this.provider.readFileStream(i,n,s.token);return $a(l,{onData:c=>a.fire(H.wrap(c)),onError:c=>a.fire(c),onEnd:()=>{a.fire("end"),a.dispose(),s.dispose()}}),a.event}writeFile(e,t,n,i){let s=this.transformIncoming(e,t);return this.provider.writeFile(s,n.buffer,i)}open(e,t,n){let i=this.transformIncoming(e,t,!0);return this.provider.open(i,n)}close(e){return this.provider.close(e)}async read(e,t,n){let i=H.alloc(n),a=await this.provider.read(e,t,i.buffer,0,n);return[i,a]}write(e,t,n,i,s){return this.provider.write(e,t,n.buffer,i,s)}mkdir(e,t){let n=this.transformIncoming(e,t);return this.provider.mkdir(n)}delete(e,t,n){let i=this.transformIncoming(e,t);return this.provider.delete(i,n)}rename(e,t,n,i){let s=this.transformIncoming(e,t),a=this.transformIncoming(e,n);return this.provider.rename(s,a,i)}copy(e,t,n,i){let s=this.transformIncoming(e,t),a=this.transformIncoming(e,n);return this.provider.copy(s,a,i)}cloneFile(e,t,n){let i=this.transformIncoming(e,t),s=this.transformIncoming(e,n);return this.provider.cloneFile(i,s)}onFileChange(e,t){let n=new x({onWillAddFirstListener:()=>{this.sessionToWatcher.set(t,this.createSessionFileWatcher(e,n))},onDidRemoveLastListener:()=>{pt(this.sessionToWatcher.get(t)),this.sessionToWatcher.delete(t)}});return n.event}async watch(e,t,n,i,s){let a=this.sessionToWatcher.get(t);if(a){let l=this.transformIncoming(e,i),c=a.watch(n,l,s);this.watchRequests.set(t+n,c)}}async unwatch(e,t){let n=e+t,i=this.watchRequests.get(n);i&&(pt(i),this.watchRequests.delete(n))}dispose(){super.dispose();for(let[,e]of this.watchRequests)e.dispose();this.watchRequests.clear();for(let[,e]of this.sessionToWatcher)e.dispose();this.sessionToWatcher.clear()}},ph=class extends C{constructor(e,t,n,i){super();this.uriTransformer=e;this.environmentService=i;this.watcherRequests=new Map;this.fileWatcher=this._register(new ts(n)),this.registerListeners(t)}registerListeners(e){let t=this._register(new x);this._register(t.event(n=>{e.fire(n.map(i=>({resource:this.uriTransformer.transformOutgoingURI(i.resource),type:i.type,cId:i.cId})))})),this._register(this.fileWatcher.onDidChangeFile(n=>t.fire(n))),this._register(this.fileWatcher.onDidWatchError(n=>e.fire(n)))}getRecursiveWatcherOptions(e){}getExtraExcludes(e){}watch(e,t,n){let i=this.getExtraExcludes(this.environmentService);return Array.isArray(i)&&(n.excludes=[...n.excludes,...i]),this.watcherRequests.set(e,this.fileWatcher.watch(t,n)),j(()=>{pt(this.watcherRequests.get(e)),this.watcherRequests.delete(e)})}dispose(){for(let[,e]of this.watcherRequests)e.dispose();this.watcherRequests.clear(),super.dispose()}}});var j0,J0=w(()=>{nt();ef();se();j0=new class{transformIncoming(o){return o}transformOutgoing(o){return o}transformOutgoingURI(o){return o}transformOutgoingScheme(o){return o}}});import{shell as eL}from"electron";var fh,Nw,Q0=w(()=>{Ce();Y();se();je();Se();G0();J0();Ro();fh=class extends uh{constructor(e,t,n){super(e,t);this.environmentService=n}getUriTransformer(e){return j0}transformIncoming(e,t){return b.revive(t)}async delete(e,t,n){if(!n.useTrash)return super.delete(e,t,n);let i=this.transformIncoming(e,t),s=kt(i.fsPath);try{await eL.trashItem(s)}catch(a){throw Gr(M?h(2098,null,ye(s),Tr(a)):h(2099,null,ye(s),Tr(a)),"Unknown")}}createSessionFileWatcher(e,t){return new Nw(e,t,this.logService,this.environmentService)}},Nw=class extends ph{watch(r,e,t){if(t.recursive)throw Gr("Recursive file watching is not supported from main process for performance reasons.","Unavailable");return super.watch(r,e,t)}}});var ae,Ou=w(()=>{ae=class{constructor(r,e=[],t=!1){this.ctor=r,this.staticArguments=e,this.supportsDelayedInstantiation=t}}});var rs,mh=w(()=>{rs=class{constructor(...r){this._entries=new Map;for(let[e,t]of r)this.set(e,t)}set(r,e){let t=this._entries.get(r);return this._entries.set(r,e),t}has(r){return this._entries.has(r)}get(r){return this._entries.get(r)}}});import{exec as hh}from"child_process";import{totalmem as tL}from"os";function Fu(o){return new Promise((r,e)=>{let t,n=new Map,i=tL();function s(l,c,d,u,f){let m=n.get(c);if(l===o||m){let y={name:a(d),cmd:d,pid:l,ppid:c,load:u,mem:M?f:i*(f/100)};n.set(l,y),l===o&&(t=y),m&&(m.children||(m.children=[]),m.children.push(y),m.children.length>1&&(m.children=m.children.sort((v,S)=>v.pid-S.pid)))}}function a(l){let c=/--utility-sub-type=network/i,d=/--crashes-directory/i,u=/conhost\.exe.+--headless/i,f=/--type=([a-zA-Z-]+)/;if(d.exec(l))return"electron-crash-reporter";if(u.exec(l))return"conpty-agent";let m=f.exec(l);if(m&&m.length===2)return m[1]==="renderer"?"window":m[1]==="utility"?c.exec(l)?"utility-network-service":"utility-process":m[1]==="extensionHost"?"extension-host":m[1];if(l.indexOf("node ")<0&&l.indexOf("node.exe")<0){let y="";do m=rL.exec(l),m&&(y+=m+" ");while(m);if(y)return`electron-nodejs (${y.trim()})`}return l}if(process.platform==="win32"){let l=c=>c.indexOf("\\\\?\\")===0||c.indexOf("\\??\\")===0?c.substring(4):c.indexOf('"\\\\?\\')===0||c.indexOf('"\\??\\')===0?'"'+c.substring(5):c;import("@vscode/windows-process-tree").then(c=>{c.getProcessList(o,d=>{if(!d){e(new Error(`Root process ${o} not found`));return}c.getProcessCpuUsage(d,u=>{let f=new Map;u.forEach(m=>{let y=l(m.commandLine||"");f.set(m.pid,{name:a(y),cmd:y,pid:m.pid,ppid:m.ppid,load:m.cpu||0,mem:m.memory||0})}),t=f.get(o),t?(f.forEach(m=>{let y=f.get(m.ppid);y&&(y.children||(y.children=[]),y.children.push(m))}),f.forEach(m=>{m.children&&(m.children=m.children.sort((y,v)=>y.pid-v.pid))}),r(t)):e(new Error(`Root process ${o} not found`))})},c.ProcessDataFlag.CommandLine|c.ProcessDataFlag.Memory)})}else{let l=function(){let c=[t],d=[];for(;c.length;){let f=c.shift();f&&(d.push(f.pid),f.children&&(c=c.concat(f.children)))}let u=JSON.stringify(et.asFileUri("vs/base/node/cpuUsage.sh").fsPath);u+=" "+d.join(" "),hh(u,{},(f,m,y)=>{if(f||y)e(f||new Error(y.toString()));else{let v=m.toString().split(`
`);for(let S=0;S<d.length;S++){let I=n.get(d[S]);I.load=parseFloat(v[S])}if(!t){e(new Error(`Root process ${o} not found`));return}r(t)}})};hh("which ps",{},(c,d,u)=>{if(c||u)if(process.platform!=="linux")e(c||new Error(u.toString()));else{let f=JSON.stringify(et.asFileUri("vs/base/node/ps.sh").fsPath);hh(f,{},(m,y,v)=>{m||v?e(m||new Error(v.toString())):(X0(y,s),l())})}else{let f=d.toString().trim();hh(`${f} -ax -o pid=,ppid=,pcpu=,pmem=,command=`,{maxBuffer:1e3*1024,env:{LC_NUMERIC:"en_US.UTF-8"}},(y,v,S)=>{y||S&&!S.includes("screen size is bogus")?e(y||new Error(S.toString())):(X0(v,s),process.platform==="linux"?l():t?r(t):e(new Error(`Root process ${o} not found`)))})}})}})}function X0(o,r){let e=/^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+\.[0-9]+)\s+([0-9]+\.[0-9]+)\s+(.+)$/,t=o.toString().split(`
`);for(let n of t){let i=e.exec(n.trim());i&&i.length===6&&r(parseInt(i[1]),parseInt(i[2]),i[5],parseFloat(i[3]),parseFloat(i[4]))}}var rL,Bw=w(()=>{ze();Y();rL=/[a-zA-Z-]+\.js\b/g});var Kl,Y0=w(()=>{Bw();Ce();Em();ew();re();Js();Kl=class{constructor(r,e,t){this.logService=r;this.diagnosticsService=e;this.diagnosticsMainService=t}async resolveProcesses(){let r=await this.diagnosticsMainService.getMainDiagnostics(),e=[];for(let n of r.windows)e.push([n.pid,`window [${n.id}] (${n.title})`]);for(let{pid:n,name:i}of or.getAll())e.push([n,i]);let t=[];try{t.push({name:h(2231,null),rootProcess:await Fu(process.pid)}),(await this.diagnosticsMainService.getRemoteDiagnostics({includeProcesses:!0})).forEach(i=>{Iu(i)?t.push({name:i.hostName,rootProcess:i}):i.processes&&t.push({name:i.hostName,rootProcess:i.processes})})}catch(n){this.logService.error(`Listing processes failed: ${n}`)}return{pidToNames:e,processes:t}}async getSystemStatus(){let[r,e]=await Promise.all([this.diagnosticsMainService.getMainDiagnostics(),this.diagnosticsMainService.getRemoteDiagnostics({includeProcesses:!1,includeWorkspaceMetadata:!1})]);return this.diagnosticsService.getDiagnostics(r,e)}async getSystemInfo(){let[r,e]=await Promise.all([this.diagnosticsMainService.getMainDiagnostics(),this.diagnosticsMainService.getRemoteDiagnostics({includeProcesses:!1,includeWorkspaceMetadata:!1})]);return await this.diagnosticsService.getSystemInfo(r,e)}async getPerformanceInfo(){try{let[r,e]=await Promise.all([this.diagnosticsMainService.getMainDiagnostics(),this.diagnosticsMainService.getRemoteDiagnostics({includeProcesses:!0,includeWorkspaceMetadata:!0})]);return await this.diagnosticsService.getPerformanceInfo(r,e)}catch(r){throw this.logService.warn("issueService#getPerformanceInfo ",r.message),r}}};Kl=T([g(0,O),g(1,wu),g(2,Rl)],Kl)});function Z0(o){let r=o.getKeyMap(),e=o.getCurrentKeyboardLayout();return{keyboardMapping:r,keyboardLayoutInfo:e}}var Vw,$l,eE=w(()=>{Y();Q();K();Z();xt();Vw=W("keyboardLayoutMainService"),$l=class extends C{constructor(e){super();this._onDidChangeKeyboardLayout=this._register(new x);this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;this._initPromise=null,this._keyboardLayoutData=null,e.when(3).then(()=>this._initialize())}_initialize(){return this._initPromise||(this._initPromise=this._doInitialize()),this._initPromise}async _doInitialize(){let e=await import("native-keymap");this._keyboardLayoutData=Z0(e),Qb||e.onDidChangeKeyboardLayout(()=>{this._keyboardLayoutData=Z0(e),this._onDidChangeKeyboardLayout.fire(this._keyboardLayoutData)})}async getKeyboardLayoutData(){return await this._initialize(),this._keyboardLayoutData}};$l=T([g(0,me)],$l)});var ql,Hw=w(()=>{Z();ql=W("urlService")});import{app as nL}from"electron";var iL,Kw,zl,tE=w(()=>{zt();Y();se();jt();st();Ol();Z();re();Hw();Wt();Qt();iL="launchMainService",Kw=W(iL),zl=class{constructor(r,e,t,n,i){this.logService=r;this.windowsMainService=e;this.urlService=t;this.configurationService=n}async start(r,e){this.logService.trace("Received data from other instance: ",r,e),V&&nL.focus({steal:!0});let t=this.parseOpenUrl(r);if(t.length){let n=Promise.resolve();if(this.windowsMainService.getWindowCount()===0){let i=(await this.windowsMainService.openEmptyWindow({context:4})).at(0);i&&(n=i.ready())}n.then(()=>{for(let{uri:i,originalUrl:s}of t)this.urlService.open(i,{originalUrl:s})})}else return this.startOpenWindow(r,e)}parseOpenUrl(r){return r["open-url"]&&r._urls&&r._urls.length>0?at(r._urls.map(e=>{try{return{uri:b.parse(e),originalUrl:e}}catch{return null}})):[]}async startOpenWindow(r,e){let t=ei(e)?0:4,n=[],i=r.wait&&r.waitMarkerFilePath?b.file(r.waitMarkerFilePath):void 0,s=r.remote||void 0,a={context:t,cli:r,userEnv:r["preserve-env"]||t===0?e:void 0,waitMarkerFileURI:i,remoteAuthority:s,forceProfile:r.profile,forceTempProfile:r["profile-temp"]};if(r.extensionDevelopmentPath)await this.windowsMainService.openExtensionDevelopmentHostWindow(r.extensionDevelopmentPath,a);else if(!r._.length&&!r["folder-uri"]&&!r["file-uri"]){let l=!1;if(r["new-window"]||a.forceProfile||a.forceTempProfile)l=!0;else if(r["reuse-window"])l=!1;else switch(this.configurationService.getValue("window")?.openWithoutArgumentsInNewWindow||"default"){case"on":l=!0;break;case"off":l=!1;break;default:l=!V}if(l)n=await this.windowsMainService.open({...a,forceNewWindow:!0,forceEmpty:!0});else{let c=this.windowsMainService.getLastActiveWindow();c?(this.windowsMainService.openExistingWindow(c,a),n=[c]):n=await this.windowsMainService.open({...a,forceEmpty:!0})}}else n=await this.windowsMainService.open({...a,forceNewWindow:r["new-window"],preferNewWindow:!r["reuse-window"]&&!r.wait,forceReuseWindow:r["reuse-window"],diffMode:r.diff,mergeMode:r.merge,addMode:r.add,removeMode:r.remove,noRecentEntry:!!r["skip-add-to-recently-opened"],gotoLineMode:r.goto});if(i&&n.length===1&&n[0])return Promise.race([n[0].whenClosedOrLoaded,w1(i.fsPath)]).then(()=>{},()=>{})}async getMainProcessId(){return this.logService.trace("Received request for process ID from other instance."),process.pid}};zl=T([g(0,O),g(1,Le),g(2,ql),g(3,ge),g(4,_e)],zl)});function $w(o){return o.submenu!==void 0}function qw(o){return o.id==="vscode.menubar.separator"}function zw(o){return o.uri!==void 0}function rE(o){return!$w(o)&&!qw(o)&&!zw(o)}var nE=w(()=>{});import{networkInterfaces as oL}from"os";function aL(o){let r=o.replace(/\-/g,":").toLowerCase();return!sL.has(r)}function iE(){let o=oL();for(let r in o){let e=o[r];if(e){for(let{mac:t}of e)if(aL(t))return t}}throw new Error("Unable to retrieve mac address (unexpected format)")}var sL,oE=w(()=>{sL=new Set(["00:00:00:00:00:00","ff:ff:ff:ff:ff:ff","ac:de:48:00:11:22"])});import{networkInterfaces as lL}from"os";async function sE(o){return Gw||(Gw=(async()=>await cL(o)||xe())()),Gw}async function cL(o){try{let r=await import("crypto"),e=iE();return r.createHash("sha256").update(e,"utf8").digest("hex")}catch(r){o(r);return}}async function aE(o){if(M){let r=await import("@vscode/windows-registry");try{return r.GetStringRegKey("HKEY_LOCAL_MACHINE",dL,"MachineId")||""}catch(e){return o(e),""}}return""}async function gh(o){try{return await(await import("@vscode/deviceid")).getDeviceId()}catch(r){return o(r),xe()}}var Uu,Gw,dL,Nu=w(()=>{Ns();Mt();oE();Y();Uu=new class{_isVirtualMachineMacAddress(o){return this._virtualMachineOUIs||(this._virtualMachineOUIs=zr.forStrings(),this._virtualMachineOUIs.set("00-50-56",!0),this._virtualMachineOUIs.set("00-0C-29",!0),this._virtualMachineOUIs.set("00-05-69",!0),this._virtualMachineOUIs.set("00-03-FF",!0),this._virtualMachineOUIs.set("00-1C-42",!0),this._virtualMachineOUIs.set("00-16-3E",!0),this._virtualMachineOUIs.set("08-00-27",!0),this._virtualMachineOUIs.set("00:50:56",!0),this._virtualMachineOUIs.set("00:0C:29",!0),this._virtualMachineOUIs.set("00:05:69",!0),this._virtualMachineOUIs.set("00:03:FF",!0),this._virtualMachineOUIs.set("00:1C:42",!0),this._virtualMachineOUIs.set("00:16:3E",!0),this._virtualMachineOUIs.set("08:00:27",!0)),!!this._virtualMachineOUIs.findSubstr(o)}value(){if(this._value===void 0){let o=0,r=0,e=lL();for(let t in e){let n=e[t];if(n)for(let{mac:i,internal:s}of n)s||(r+=1,this._isVirtualMachineMacAddress(i.toUpperCase())&&(o+=1))}this._value=r>0?o/r:0}return this._value}};dL="Software\\Microsoft\\SQMClient"});import*as vh from"net";function cE(o,r,e,t=1){let n=!1;return new Promise(i=>{let s=setTimeout(()=>{if(!n)return n=!0,i(0)},e);jw(o,r,t,a=>{if(!n)return n=!0,clearTimeout(s),i(a)})})}function jw(o,r,e,t){if(r===0)return t(0);let n=new vh.Socket;n.once("connect",()=>(lE(n),jw(o+e,r-1,e,t))),n.once("data",()=>{}),n.once("error",i=>(lE(n),i.code!=="ECONNREFUSED"?jw(o+e,r-1,e,t):t(o))),n.connect(o,"127.0.0.1")}function dE(o,r){return Qw(o,0,r).then(e=>e!==0)}function Qw(o,r,e,t="127.0.0.1"){let n=!1,i,s=1,a=vh.createServer({pauseOnConnect:!0});function l(c,d){n||(n=!0,a.removeAllListeners(),a.close(),i&&clearTimeout(i),d(c))}return new Promise(c=>{i=setTimeout(()=>{l(0,c)},e),a.on("listening",()=>{l(o,c)}),a.on("error",d=>{d&&(d.code==="EADDRINUSE"||d.code==="EACCES")&&s<r?(o++,s++,a.listen(o,t)):l(0,c)}),a.on("close",()=>{l(0,c)}),a.listen(o,t)})}function lE(o){try{o.removeAllListeners("connect"),o.removeAllListeners("error"),o.end(),o.destroy(),o.unref()}catch(r){console.error(r)}}var Jw,Xw=w(()=>{Jw={1:!0,7:!0,9:!0,11:!0,13:!0,15:!0,17:!0,19:!0,20:!0,21:!0,22:!0,23:!0,25:!0,37:!0,42:!0,43:!0,53:!0,69:!0,77:!0,79:!0,87:!0,95:!0,101:!0,102:!0,103:!0,104:!0,109:!0,110:!0,111:!0,113:!0,115:!0,117:!0,119:!0,123:!0,135:!0,137:!0,139:!0,143:!0,161:!0,179:!0,389:!0,427:!0,465:!0,512:!0,513:!0,514:!0,515:!0,526:!0,530:!0,531:!0,532:!0,540:!0,548:!0,554:!0,556:!0,563:!0,587:!0,601:!0,636:!0,989:!0,990:!0,993:!0,995:!0,1719:!0,1720:!0,1723:!0,2049:!0,3659:!0,4045:!0,5060:!0,5061:!0,6e3:!0,6566:!0,6665:!0,6666:!0,6667:!0,6668:!0,6669:!0,6697:!0,10080:!0}});var UY,Yw=w(()=>{Z();UY=W("nativeHostService")});import*as uE from"fs";import*as pE from"child_process";async function fE(o=!1){return(Zw===void 0||o)&&(Zw=uL()),Zw}async function uL(){let o=await Wf();if(o===0)return!1;if(o>=22e3){let r=pL();if(r)return new Promise(e=>{try{pE.execFile(r,["--status"],t=>e(!t))}catch{e(!1)}})}else{let r=fL();if(r)try{if((await uE.promises.stat(r)).isFile())return!0}catch{}}return!1}function mE(o){let r=process.env.SystemRoot;if(r){let e=process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432");return U(r,e?"Sysnative":"System32",o)}}function pL(){return mE("wsl.exe")}function fL(){return mE("lxss\\LxssManager.dll")}var Zw,hE=w(()=>{Se();el()});var Gl,gE=w(()=>{he();re();Gl=class{constructor(r,e,t){this._window=r;this._sessionId=e;this._logService=t}async inspect(r){await this._connect();let e=this._window.webContents.debugger;await e.sendCommand("Profiler.start"),this._logService.warn("[perf] profiling STARTED",this._sessionId),await lt(r);let t=await e.sendCommand("Profiler.stop");return this._logService.warn("[perf] profiling DONE",this._sessionId),await this._disconnect(),t.profile}async _connect(){let r=this._window.webContents.debugger;r.attach(),await r.sendCommand("Profiler.enable")}async _disconnect(){let r=this._window.webContents.debugger;await r.sendCommand("Profiler.disable"),r.detach()}};Gl=T([g(2,O)],Gl)});import{createWriteStream as mL,promises as QY}from"fs";async function vE(o,r){let{ZipFile:e}=await import("yazl");return new Promise((t,n)=>{let i=new e;r.forEach(a=>{a.contents?i.addBuffer(typeof a.contents=="string"?Buffer.from(a.contents,"utf8"):a.contents,a.path):a.localPath&&i.addFile(a.localPath,a.path)}),i.end();let s=mL(o);i.outputStream.pipe(s),i.outputStream.once("error",n),s.once("error",n),s.once("finish",()=>t(o))})}var hL,eZ,yE=w(()=>{he();Se();We();jt();Ce();hL="end of central directory record signature not found",eZ=new RegExp(hL)});function gL(o){return o.res.statusCode&&o.res.statusCode>=200&&o.res.statusCode<300||o.res.statusCode===1223}function vL(o){return o.res.statusCode===204}async function na(o){if(!gL(o))throw new Error("Server returned "+o.res.statusCode);if(vL(o))return null;let e=(await Ds(o.stream)).toString();try{return JSON.parse(e)}catch(t){throw t.message+=`:
`+e,t}}function yL(o=!0,r=!0){if(wE===o&&IE===r)return;wE=o,IE=r;let e=Tt.as(tr.Configuration),t=eI;eI=[{id:"http",order:15,title:h(2277,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:r,markdownDescription:h(2292,null),restricted:!0}}},{id:"http",order:15,title:h(2277,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:h(2275,null),restricted:!0}}},{id:"http",order:15,title:h(2277,null),type:"object",scope:o?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:h(2280,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:h(2288,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:h(2282,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:h(2279,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:h(2281,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[h(2285,null),h(2286,null),h(2284,null),h(2287,null)],default:"override",markdownDescription:h(2283,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:h(2289,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificatesNode":{type:"boolean",tags:["experimental"],default:rI,markdownDescription:h(2290,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:h(2291,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:h(2276,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.experimental.networkInterfaceCheckInterval":{type:"number",default:300,minimum:-1,tags:["experimental"],markdownDescription:h(2278,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}}}}],e.updateConfigurations({add:eI,remove:t})}var Ln,tI,yh,rI,eI,wE,IE,ns=w(()=>{nt();Ve();K();Ce();Gi();Z();jn();Ln=W("requestService"),tI=class{constructor(r){this.original=r}toJSON(){if(!this.headers){let r=Object.create(null);for(let e in this.original)e.toLowerCase()==="authorization"||e.toLowerCase()==="proxy-authorization"?r[e]="*****":r[e]=this.original[e];this.headers=r}return this.headers}},yh=class extends C{constructor(e){super();this.logService=e;this.counter=0}async logAndRequest(e,t){let n=`#${++this.counter}: ${e.url}`;this.logService.trace(`${n} - begin`,e.type,new tI(e.headers??{}));try{let i=await t();return this.logService.trace(`${n} - end`,e.type,i.res.statusCode,i.res.headers),i}catch(i){throw this.logService.error(`${n} - error`,e.type,qt(i)),i}}};rI=!1,eI=[];yL()});import*as xE from"os";import*as vr from"fs";import{execFile as bE}from"child_process";import{promisify as SE}from"util";async function wL(){let o=process.env.SHELL,r=xE.homedir();if(o?.includes("fish")){let t=U(r,".config","fish"),n=U(t,"config.fish");await vr.promises.mkdir(t,{recursive:!0});try{await vr.promises.access(n)}catch{await vr.promises.writeFile(n,"","utf8")}return{path:n,type:"fish"}}else if(o?.includes("zsh")){let t=U(r,".zshrc");try{await vr.promises.access(t)}catch{await vr.promises.writeFile(t,"","utf8")}return{path:t,type:"zsh"}}else if(o?.includes("bash")){let t=U(r,".bash_profile"),n=U(r,".bashrc");try{return await vr.promises.access(t),{path:t,type:"bash"}}catch{try{await vr.promises.access(n)}catch{await vr.promises.writeFile(n,"","utf8")}return{path:n,type:"bash"}}}let e=U(r,".bashrc");try{await vr.promises.access(e)}catch{await vr.promises.writeFile(e,"","utf8")}return{path:e,type:"bash"}}async function Bu(o,r){if(M)return IL(o);let e=await wL();if(!e)return;let t;try{t=`${e.path}.backup-${Date.now()}`,await vr.promises.copyFile(e.path,t);let n=await vr.promises.readFile(e.path,"utf8"),i;if(e.type==="fish"?i=`fish_add_path ${o}`:i=`export PATH="${o}:$PATH"`,n.includes(i)){await vr.promises.unlink(t);return}n=`${n}
# Added by ${r}
${i}
`,await vr.promises.writeFile(e.path,n,"utf8"),await vr.promises.unlink(t)}catch(n){if(console.error("Failed to modify PATH:",n),t)try{await vr.promises.copyFile(t,e.path),await vr.promises.unlink(t),console.log("Successfully restored shell config from backup")}catch(i){console.error("Failed to restore from backup:",i)}throw n}}async function IL(o){let r="";try{let{stdout:n}=await SE(bE)("reg",["query","HKCU\\Environment","/v","Path"],{encoding:"utf8"}),i=n.match(/Path\s+REG(?:_EXPAND)?_SZ\s+(.*)/i);i&&(r=i[1].trim())}catch(n){if(!n||typeof n!="object"||n.code!==1)throw n}if(r.split(";").map(n=>n.toLowerCase()).includes(o.toLowerCase()))return;let t=r?`${r};${o}`:o;await SE(bE)("reg",["add","HKCU\\Environment","/v","Path","/t","REG_EXPAND_SZ","/d",t,"/f"],{encoding:"utf8"})}var PE=w(()=>{Se();Y()});function EE(o){return o.toLowerCase().replace("windsurf","surf")}function TE(o){switch(o.toLowerCase()){case"windsurf-insiders":return"devin-insiders";case"windsurf-next":return"devin-next";default:return"devin"}}var CE=w(()=>{});import*as Ri from"fs";import{exec as _E}from"child_process";import{app as Vu,BrowserWindow as wh,clipboard as is,contentTracing as SL,Menu as Hu,Notification as kE,powerMonitor as bn,powerSaveBlocker as nI,screen as Ku,shell as iI,webContents as xL}from"electron";import{arch as PL,cpus as EL,freemem as TL,loadavg as CL,platform as _L,release as kL,totalmem as RL,type as DL,homedir as oI}from"os";import{promisify as RE}from"util";var Di,ia,$u=w(()=>{Wo();St();Q();K();ze();Se();Y();se();Nu();jt();Xw();Ce();js();Ot();Z();xt();re();Yw();Qt();pl();xi();Wt();hr();jo();nt();hE();gE();Qs();Ve();yE();st();Ay();ns();PE();an();CE();Di=W("nativeHostMainService"),ia=class extends C{constructor(e,t,n,i,s,a,l,c,d,u,f,m,y){super();this.windowsMainService=e;this.auxiliaryWindowsMainService=t;this.dialogMainService=n;this.lifecycleMainService=i;this.environmentMainService=s;this.logService=a;this.productService=l;this.themeMainService=c;this.workspacesManagementMainService=d;this.configurationService=u;this.requestService=f;this.proxyAuthService=m;this.instantiationService=y;this._onDidChangePassword=this._register(new x);this.onDidChangePassword=this._onDidChangePassword.event;this.activeToasts=this._register(new cr);this.onDidOpenMainWindow=E.map(this.windowsMainService.onDidOpenWindow,v=>v.id),this.onDidTriggerWindowSystemContextMenu=E.any(E.map(this.windowsMainService.onDidTriggerSystemContextMenu,({window:v,x:S,y:I})=>({windowId:v.id,x:S,y:I})),E.map(this.auxiliaryWindowsMainService.onDidTriggerSystemContextMenu,({window:v,x:S,y:I})=>({windowId:v.id,x:S,y:I}))),this.onDidMaximizeWindow=E.any(E.map(this.windowsMainService.onDidMaximizeWindow,v=>v.id),E.map(this.auxiliaryWindowsMainService.onDidMaximizeWindow,v=>v.id)),this.onDidUnmaximizeWindow=E.any(E.map(this.windowsMainService.onDidUnmaximizeWindow,v=>v.id),E.map(this.auxiliaryWindowsMainService.onDidUnmaximizeWindow,v=>v.id)),this.onDidChangeWindowFullScreen=E.any(E.map(this.windowsMainService.onDidChangeFullScreen,v=>({windowId:v.window.id,fullscreen:v.fullscreen})),E.map(this.auxiliaryWindowsMainService.onDidChangeFullScreen,v=>({windowId:v.window.id,fullscreen:v.fullscreen}))),this.onDidChangeWindowAlwaysOnTop=E.any(E.None,E.map(this.auxiliaryWindowsMainService.onDidChangeAlwaysOnTop,v=>({windowId:v.window.id,alwaysOnTop:v.alwaysOnTop}))),this.onDidBlurMainWindow=E.filter(E.fromNodeEventEmitter(Vu,"browser-window-blur",(v,S)=>S.id),v=>!!this.windowsMainService.getWindowById(v)),this.onDidFocusMainWindow=E.any(E.map(E.filter(E.map(this.windowsMainService.onDidChangeWindowsCount,()=>this.windowsMainService.getLastActiveWindow()),v=>!!v),v=>v.id),E.filter(E.fromNodeEventEmitter(Vu,"browser-window-focus",(v,S)=>S.id),v=>!!this.windowsMainService.getWindowById(v))),this.onDidBlurMainOrAuxiliaryWindow=E.any(this.onDidBlurMainWindow,E.map(E.filter(E.fromNodeEventEmitter(Vu,"browser-window-blur",(v,S)=>this.auxiliaryWindowsMainService.getWindowByWebContents(S.webContents)),v=>!!v),v=>v.id)),this.onDidFocusMainOrAuxiliaryWindow=E.any(this.onDidFocusMainWindow,E.map(E.filter(E.fromNodeEventEmitter(Vu,"browser-window-focus",(v,S)=>this.auxiliaryWindowsMainService.getWindowByWebContents(S.webContents)),v=>!!v),v=>v.id)),this.onDidSuspendOS=E.fromNodeEventEmitter(bn,"suspend"),this.onDidResumeOS=E.fromNodeEventEmitter(bn,"resume"),this.onDidChangeOnBatteryPower=E.any(E.map(E.fromNodeEventEmitter(bn,"on-ac"),()=>!1),E.map(E.fromNodeEventEmitter(bn,"on-battery"),()=>!0)),this.onDidChangeThermalState=E.map(E.fromNodeEventEmitter(bn,"thermal-state-change"),v=>v.state),this.onDidChangeSpeedLimit=E.map(E.fromNodeEventEmitter(bn,"speed-limit-change"),v=>v.limit),this.onWillShutdownOS=E.fromNodeEventEmitter(bn,"shutdown"),this.onDidLockScreen=E.fromNodeEventEmitter(bn,"lock-screen"),this.onDidUnlockScreen=E.fromNodeEventEmitter(bn,"unlock-screen"),this.onDidChangeColorScheme=this.themeMainService.onDidChangeColorScheme,this.onDidChangeDisplay=E.debounce(E.any(E.filter(E.fromNodeEventEmitter(Ku,"display-metrics-changed",(v,S,I)=>I),v=>!(Array.isArray(v)&&v.length===1&&v[0]==="workArea")),E.fromNodeEventEmitter(Ku,"display-added"),E.fromNodeEventEmitter(Ku,"display-removed")),()=>{},100)}get windowId(){throw new Error("Not implemented in electron-main")}async getWindows(e,t){let n=this.windowsMainService.getWindows().map(s=>({id:s.id,workspace:s.openedWorkspace??No(s.backupPath,s.isExtensionDevelopmentHost),title:s.win?.getTitle()??"",filename:s.getRepresentedFilename(),dirty:s.isDocumentEdited()})),i=[];return t.includeAuxiliaryWindows&&i.push(...this.auxiliaryWindowsMainService.getWindows().map(s=>({id:s.id,parentId:s.parentId,title:s.win?.getTitle()??"",filename:s.getRepresentedFilename()}))),[...n,...i]}async getWindowCount(e){return this.windowsMainService.getWindowCount()}async getActiveWindowId(e){let t=this.windowsMainService.getFocusedWindow()||this.windowsMainService.getLastActiveWindow();if(t)return t.id}async getActiveWindowPosition(){let e=this.windowsMainService.getFocusedWindow()||this.windowsMainService.getLastActiveWindow();if(e)return e.getBounds()}async getNativeWindowHandle(e,t){let n=this.windowById(t,e);if(n?.win)return H.wrap(n.win.getNativeWindowHandle())}openWindow(e,t,n){return Array.isArray(t)?this.doOpenWindow(e,t,n):this.doOpenEmptyWindow(e,t)}async doOpenWindow(e,t,n=Object.create(null)){t.length>0&&await this.windowsMainService.open({context:5,contextWindowId:e,urisToOpen:t,cli:this.environmentMainService.args,forceNewWindow:n.forceNewWindow,forceReuseWindow:n.forceReuseWindow,preferNewWindow:n.preferNewWindow,diffMode:n.diffMode,mergeMode:n.mergeMode,addMode:n.addMode,removeMode:n.removeMode,gotoLineMode:n.gotoLineMode,noRecentEntry:n.noRecentEntry,waitMarkerFileURI:n.waitMarkerFileURI,remoteAuthority:n.remoteAuthority||void 0,forceProfile:n.forceProfile,forceTempProfile:n.forceTempProfile})}async doOpenEmptyWindow(e,t){await this.windowsMainService.openEmptyWindow({context:5,contextWindowId:e},t)}async openSessionsWindow(e){await this.windowsMainService.openSessionsWindow({context:5,contextWindowId:e})}async isFullScreen(e,t){return this.windowById(t?.targetWindowId,e)?.isFullScreen??!1}async toggleFullScreen(e,t){this.windowById(t?.targetWindowId,e)?.toggleFullScreen()}async getCursorScreenPoint(e){let t=Ku.getCursorScreenPoint(),n=Ku.getDisplayNearestPoint(t);return{point:t,display:n.bounds}}async isMaximized(e,t){return this.windowById(t?.targetWindowId,e)?.win?.isMaximized()??!1}async maximizeWindow(e,t){this.windowById(t?.targetWindowId,e)?.win?.maximize()}async unmaximizeWindow(e,t){this.windowById(t?.targetWindowId,e)?.win?.unmaximize()}async minimizeWindow(e,t){this.windowById(t?.targetWindowId,e)?.win?.minimize()}async moveWindowTop(e,t){this.windowById(t?.targetWindowId,e)?.win?.moveTop()}async isWindowAlwaysOnTop(e,t){return this.windowById(t?.targetWindowId,e)?.win?.isAlwaysOnTop()??!1}async toggleWindowAlwaysOnTop(e,t){let n=this.windowById(t?.targetWindowId,e);n?.win?.setAlwaysOnTop(!n.win.isAlwaysOnTop())}async setWindowAlwaysOnTop(e,t,n){this.windowById(n?.targetWindowId,e)?.win?.setAlwaysOnTop(t)}async positionWindow(e,t,n){let i=this.windowById(n?.targetWindowId,e);if(i?.win){if(i.win.isFullScreen()){let s=E.toPromise(E.once(E.fromNodeEventEmitter(i.win,"leave-full-screen")));i.win.setFullScreen(!1),await s}i.win.setBounds(t)}}async updateWindowControls(e,t){this.windowById(t?.targetWindowId,e)?.updateWindowControls(t)}async updateWindowAccentColor(e,t,n){if(!M)return;let i=this.windowById(e);if(!i)return;let s,a;t==="default"?(s=null,a=null):t==="off"?(s=!1,a=!1):(s=t,a=n??t);let l=[i];for(let c of this.auxiliaryWindowsMainService.getWindows())c.parentId===e&&l.push(c);for(let c of l)c.win?.setAccentColor(c.win.isFocused()?s:a)}async focusWindow(e,t){this.windowById(t?.targetWindowId,e)?.focus({mode:t?.mode??0})}async setMinimumSize(e,t,n){let i=this.codeWindowById(e);if(i?.win){let[s,a]=i.win.getSize(),[l,c]=i.win.getMinimumSize(),[d,u]=[t??l,n??c],[f,m]=[Math.max(s,d),Math.max(a,u)];(l!==d||c!==u)&&i.win.setMinimumSize(d,u),(s!==f||a!==m)&&i.win.setSize(f,m)}}async saveWindowSplash(e,t){let n=this.codeWindowById(e);this.themeMainService.saveWindowSplash(e,n?.openedWorkspace,t)}async setBackgroundThrottling(e,t){let n=this.codeWindowById(e);this.logService.trace(`Setting background throttling for window ${e} to '${t}'`),n?.win?.webContents?.setBackgroundThrottling(t)}async installShellCommandOne(e,t,n,i){let s=$e(t);await Ri.promises.mkdir(s,{recursive:!0});try{let{symbolicLink:a}=await Yt.stat(t);if(a&&!a.dangling){let l=await q.realpath(t);if(n===l)return i.addSymlinkDirToPath&&await Bu(s,this.productService.nameShort),{success:!0,directoryAddedToPath:s}}await Ri.promises.unlink(t)}catch(a){if(a.code!=="ENOENT")throw a}return await this.installShellCommandWithPrivileges(e,n,t,s,i)}async installShellCommandWithPrivileges(e,t,n,i,s){try{return await Ri.promises.symlink(t,n),s.addSymlinkDirToPath&&await Bu(i,this.productService.nameShort),{success:!0,directoryAddedToPath:i}}catch(a){if(a.code!=="EACCES"&&a.code!=="ENOENT")throw a;if(!s.tryOsascriptIfAccessError)return{success:!1,directoryAddedToPath:null};if(!V)throw new Error(h(2212,null,n));let{response:l}=await this.showMessageBox(e,{type:"info",message:h(2226,null,this.productService.nameShort),buttons:[h(2219,null),h(2211,null)]});if(l===1)throw new Et;try{let c=`osascript -e "do shell script \\"mkdir -p '${i}' && ln -sf '${t}' '${n}'\\" with administrator privileges"`;await RE(_E)(c)}catch{throw new Error(h(2212,null,n))}return{success:!0,directoryAddedToPath:i}}}async installShellCommand(e){let{symlinkSources:t,binaryPath:n}=await this.getShellCommandLink(),i=[],s=[];for(let{path:a,canFailSilently:l}of t){let c=!s.includes($e(a)),{success:d,directoryAddedToPath:u}=await this.installShellCommandOne(e,a,n,{addSymlinkDirToPath:c,tryOsascriptIfAccessError:!l});d&&(u&&s.push(u),i.push(ye(a)))}if(i.length===0)throw new Error(h(2217,null,n));return i[0]}async uninstallShellCommandOne(e,t,n){try{await Ri.promises.unlink(t)}catch(i){switch(i.code){case"EACCES":{if(!n.tryOsascriptIfAccessError)return{success:!1};if(!V)throw new Error(h(2213,null,t));let{response:s}=await this.showMessageBox(e,{type:"info",message:h(2227,null,this.productService.nameShort),buttons:[h(2219,null),h(2211,null)]});if(s===1)throw new Et;try{let a=`osascript -e "do shell script \\"rm '${t}'\\" with administrator privileges"`;await RE(_E)(a)}catch{throw new Error(h(2213,null,t))}break}case"ENOENT":break;default:throw i}}return{success:!0}}async uninstallShellCommand(e){let{symlinkSources:t}=await this.getShellCommandLink(),n=[];for(let{path:i,canFailSilently:s}of t){let{success:a}=await this.uninstallShellCommandOne(e,i,{tryOsascriptIfAccessError:!s});a&&n.push(ye(i))}if(n.length===0)throw new Error(h(2218,null,t[0].path));return n[0]}async getShellCommandLink(){let e=It(this.environmentMainService.appRoot,"bin",this.productService.applicationName),t=It(oI(),".codeium","windsurf","bin"),n=this.productService.applicationName,i=EE(n),s=It(t,i),a=It(t,n),l=[{path:s,canFailSilently:!1},{path:a,canFailSilently:!0}];if(this.productService.windsurf_multi_tenant_mode&&(l.push({path:It(t,"surf"),canFailSilently:!0}),l.push({path:It(t,"windsurf"),canFailSilently:!0})),!await q.exists(e))throw new Error(h(2222,null,e));return{symlinkSources:l,binaryPath:e}}async installDevinCli(e){let t=M?"devin.exe":"devin",n=It(this.environmentMainService.appRoot,"extensions","windsurf","devin","bin"),i=It(n,t);if(!await q.exists(i))throw new Error(h(2216,null,this.productService.nameShort));let a=TE(this.productService.applicationName);if(M){let l=It(process.env.LOCALAPPDATA||It(oI(),"AppData","Local"),"devin","bin");await Ri.promises.mkdir(l,{recursive:!0});let c=It(l,`${a}.exe`);if(await q.exists(c))throw new Error(h(2215,null,c));await Ri.promises.copyFile(i,c),await Bu(l,this.productService.nameShort)}else{let l=It(oI(),".local","bin");await Ri.promises.mkdir(l,{recursive:!0});let c=It(l,a);if(await q.exists(c))throw new Error(h(2215,null,c));await Ri.promises.symlink(i,c),await Bu(l,this.productService.nameShort)}}async showMessageBox(e,t){let n=this.windowById(t?.targetWindowId,e);return this.dialogMainService.showMessageBox(t,n?.win??void 0)}async showSaveDialog(e,t){let n=this.windowById(t?.targetWindowId,e);return this.dialogMainService.showSaveDialog(t,n?.win??void 0)}async showOpenDialog(e,t){let n=this.windowById(t?.targetWindowId,e);return this.dialogMainService.showOpenDialog(t,n?.win??void 0)}async pickFileFolderAndOpen(e,t){let n=await this.dialogMainService.pickFileFolder(t);n&&await this.doOpenPicked(await Promise.all(n.map(async i=>await Yt.existsDirectory(i)?{folderUri:b.file(i)}:{fileUri:b.file(i)})),t,e)}async pickFolderAndOpen(e,t){let n=await this.dialogMainService.pickFolder(t);n&&await this.doOpenPicked(n.map(i=>({folderUri:b.file(i)})),t,e)}async pickFileAndOpen(e,t){let n=await this.dialogMainService.pickFile(t);n&&await this.doOpenPicked(n.map(i=>({fileUri:b.file(i)})),t,e)}async pickWorkspaceAndOpen(e,t){let n=await this.dialogMainService.pickWorkspace(t);n&&await this.doOpenPicked(n.map(i=>({workspaceUri:b.file(i)})),t,e)}async doOpenPicked(e,t,n){await this.windowsMainService.open({context:3,contextWindowId:n,cli:this.environmentMainService.args,urisToOpen:e,forceNewWindow:t.forceNewWindow})}async showItemInFolder(e,t){iI.showItemInFolder(t)}async setRepresentedFilename(e,t,n){this.windowById(n?.targetWindowId,e)?.setRepresentedFilename(t)}async setDocumentEdited(e,t,n){this.windowById(n?.targetWindowId,e)?.setDocumentEdited(t)}async openExternal(e,t,n){this.environmentMainService.unsetSnapExportedVariables();try{Tv(t,N.http,N.https)?this.openExternalBrowser(e,t,n):this.doOpenShellExternal(e,t)}finally{this.environmentMainService.restoreSnapExportedVariables()}return!0}async openExternalBrowser(e,t,n){let i=n??this.configurationService.getValue("workbench.externalBrowser");if(!i)return this.doOpenShellExternal(e,t);if((i.includes(ue.sep)||i.includes(ut.sep))&&!await q.exists(i))return this.logService.error(`Configured external browser path does not exist: ${i}`),this.doOpenShellExternal(e,t);try{let{default:s,apps:a}=await import("open"),l=await s(t,{app:{name:Object.hasOwn(a,i)?a[i]:i}});M||l.stderr?.once("data",c=>(this.logService.error(`Error openening external URL '${t}' using browser '${i}': ${c.toString()}`),this.doOpenShellExternal(e,t)))}catch(s){return this.logService.error(`Unable to open external URL '${t}' using browser '${i}' due to ${s}.`),this.doOpenShellExternal(e,t)}}async doOpenShellExternal(e,t){try{await iI.openExternal(t)}catch(n){let i,s;Tv(t,N.http,N.https)?(i=!0,s=h(2220,null)):(i=!1,s=h(2221,null));let{response:a}=await this.dialogMainService.showMessageBox({type:"error",message:s,detail:n.message,buttons:i?[h(2214,null),h(2211,null)]:[h(2219,null)]},this.windowById(e)?.win??void 0);if(a===1)return;this.writeClipboardText(e,t)}}moveItemToTrash(e,t){return iI.trashItem(t)}async isAdmin(){let e;return M?e=(await import("native-is-elevated")).default():e=process.getuid?.()===0,e}async writeElevated(e,t,n,i){let s=await import("@vscode/sudo-prompt"),a=Ts(this.environmentMainService.userDataPath,"code-elevated");await q.writeFile(a,JSON.stringify({source:t.fsPath,target:n.fsPath}));try{await new Promise((l,c)=>{let d=[`"${this.cliPath}"`];i?.unlock&&d.push("--file-chmod"),d.push("--file-write",`"${a}"`);let u={name:this.productService.nameLong.replace("-",""),icns:V&&this.environmentMainService.isBuilt?U($e(this.environmentMainService.appRoot),`${this.productService.nameShort}.icns`):void 0};this.logService.trace(`[sudo-prompt] running command: ${d.join(" ")}`),s.exec(d.join(" "),u,(f,m,y)=>{m&&this.logService.trace(`[sudo-prompt] received stdout: ${m}`),y&&this.logService.error(`[sudo-prompt] received stderr: ${y}`),f?c(f):l(void 0)})})}finally{await Ri.promises.unlink(a)}}async isRunningUnderARM64Translation(){return ne||M?!1:Vu.runningUnderARM64Translation}get cliPath(){return M?this.environmentMainService.isBuilt?U($e(process.execPath),"bin",`${this.productService.applicationName}.cmd`):U(this.environmentMainService.appRoot,"scripts","code-cli.bat"):ne?this.environmentMainService.isBuilt?U($e(process.execPath),"bin",`${this.productService.applicationName}`):U(this.environmentMainService.appRoot,"scripts","code-cli.sh"):this.environmentMainService.isBuilt?U(this.environmentMainService.appRoot,"bin",`${this.productService.applicationName}`):U(this.environmentMainService.appRoot,"scripts","code-cli.sh")}async getOSStatistics(){return{totalmem:RL(),freemem:TL(),loadavg:CL()}}async getOSProperties(){return{arch:PL(),platform:_L(),release:kL(),type:DL(),cpus:EL()}}async getOSVirtualMachineHint(){return Uu.value()}async getOSColorScheme(){return this.themeMainService.getColorScheme()}async hasWSLFeatureInstalled(){return M&&fE()}async getScreenshot(e,t,n){let a=(await this.windowById(n?.targetWindowId,e)?.win?.webContents.capturePage(t))?.toJPEG(95);return a&&H.wrap(a)}async getProcessId(e){return this.windowById(void 0,e)?.win?.webContents.getOSProcessId()}async killProcess(e,t,n){process.kill(t,n)}async readClipboardText(e,t){this.logService.trace(`readClipboardText in window ${e} with type:`,t);let n=is.readText(t);return this.logService.trace("clipboardText.length :",n.length),n}async triggerPaste(e,t){return this.logService.trace(`Triggering paste in window ${e} with options:`,t),this.windowById(t?.targetWindowId,e)?.win?.webContents.paste()??Promise.resolve()}async readImage(){return is.readImage().toPNG()}async writeClipboardText(e,t,n){return is.writeText(t,n)}async readClipboardFindText(e){return is.readFindText()}async writeClipboardFindText(e,t){return is.writeFindText(t)}async writeClipboardBuffer(e,t,n,i){return is.writeBuffer(t,Buffer.from(n.buffer),i)}async readClipboardBuffer(e,t){return H.wrap(is.readBuffer(t))}async hasClipboard(e,t,n){return is.has(t,n)}async newWindowTab(){await this.windowsMainService.open({context:5,cli:this.environmentMainService.args,forceNewTabbedWindow:!0,forceEmpty:!0,remoteAuthority:this.environmentMainService.args.remote||void 0})}async showPreviousWindowTab(){Hu.sendActionToFirstResponder("selectPreviousTab:")}async showNextWindowTab(){Hu.sendActionToFirstResponder("selectNextTab:")}async moveWindowTabToNewWindow(){Hu.sendActionToFirstResponder("moveTabToNewWindow:")}async mergeAllWindowTabs(){Hu.sendActionToFirstResponder("mergeAllWindows:")}async toggleWindowTabsBar(){Hu.sendActionToFirstResponder("toggleTabBar:")}async updateTouchBar(e,t){this.codeWindowById(e)?.updateTouchBar(t)}async notifyReady(e){this.codeWindowById(e)?.setReady()}async relaunch(e,t){return this.lifecycleMainService.relaunch(t)}async reload(e,t){let n=this.codeWindowById(e);if(n){if(it(n.openedWorkspace)){let i=n.openedWorkspace.configPath;if(i.scheme===N.file&&(await this.workspacesManagementMainService.resolveLocalWorkspace(i))?.transient)return this.openWindow(n.id,{forceReuseWindow:!0})}return this.lifecycleMainService.reload(n,t?.disableExtensions!==void 0?{_:[],"disable-extensions":t.disableExtensions}:void 0)}}async closeWindow(e,t){return this.windowById(t?.targetWindowId,e)?.win?.close()}async quit(e){let t=this.windowsMainService.getLastActiveWindow();t?.isExtensionDevelopmentHost&&this.windowsMainService.getWindowCount()>1&&t.win?t.win.close():this.lifecycleMainService.quit()}async exit(e,t){await this.lifecycleMainService.kill(t)}async resolveProxy(e,t){return this.codeWindowById(e)?.win?.webContents?.session?.resolveProxy(t)}async lookupAuthorization(e,t){return this.proxyAuthService.lookupAuthorization(t)}async lookupKerberosAuthorization(e,t){return this.requestService.lookupKerberosAuthorization(t)}async loadCertificates(e){return this.requestService.loadCertificates()}isPortFree(e,t){return dE(t,1e3)}findFreePort(e,t,n,i,s=1){return cE(t,n,i,s)}async openDevTools(e,t){this.windowById(t?.targetWindowId,e)?.win?.webContents.openDevTools(t?.mode?{mode:t.mode,activate:t.activate}:void 0)}async toggleDevTools(e,t){this.windowById(t?.targetWindowId,e)?.win?.webContents.toggleDevTools()}async openDevToolsWindow(e,t){let n=this.codeWindowById(e);n&&this.openChildWindow(n.win,t)}openChildWindow(e,t,n={}){let s={...this.instantiationService.invokeFunction(fl,Si(),{forceNativeTitlebar:!0}),parent:e??void 0,...n},a=new wh(s);return a.setMenuBarVisibility(!1),a.loadURL(t),a.once("ready-to-show",()=>a.show()),a}async openGPUInfoWindow(e){let t=this.codeWindowById(e);if(t){if(typeof this.gpuInfoWindowId!="number"){let n=this.openChildWindow(t.win,"chrome://gpu");n.once("close",()=>this.gpuInfoWindowId=void 0),this.gpuInfoWindowId=n.id}if(typeof this.gpuInfoWindowId=="number"){let n=wh.fromId(this.gpuInfoWindowId);n?.isMinimized()&&n?.restore(),n?.focus()}}}async openContentTracingWindow(){if(typeof this.contentTracingWindowId!="number"){let e=this.openChildWindow(null,"chrome://tracing",{paintWhenInitiallyHidden:!1,webPreferences:{backgroundThrottling:!1}});e.webContents.once("did-finish-load",async()=>{await e.webContents.executeJavaScript(`
					window.prompt = () => '';
					null
				`),e.show()}),e.once("close",()=>this.contentTracingWindowId=void 0),this.contentTracingWindowId=e.id}if(typeof this.contentTracingWindowId=="number"){let e=wh.fromId(this.contentTracingWindowId);e?.isMinimized()&&e?.restore(),e?.focus()}}async stopTracing(e){if(!this.environmentMainService.args.trace)return;let t=await SL.stopRecording(`${Ts(this.environmentMainService.userHome.fsPath,this.productService.applicationName)}.trace.txt`);await this.dialogMainService.showMessageBox({type:"info",message:h(2224,null),detail:h(2223,null,t),buttons:[h(2225,null)]},wh.getFocusedWindow()??void 0),this.showItemInFolder(void 0,t)}async profileRenderer(e,t,n){let i=this.codeWindowById(e);if(!i?.win)throw new Error;return await new Gl(i.win,t,this.logService).inspect(n)}async showToast(e,t){if(!kE.isSupported())return{supported:!1,clicked:!1};let n=new kE({title:t.title,body:t.body,silent:t.silent,actions:t.actions?.map(a=>({type:"button",text:a}))}),i=new te;this.activeToasts.set(t.id,i);let s=new qe;return i.add(j(()=>{this.activeToasts.deleteAndDispose(t.id),n.removeAllListeners(),n.close(),s.dispose(!0)})),new Promise(a=>{let l=c=>{a(c),i.dispose()};i.add(s.token.onCancellationRequested(()=>l({supported:!0,clicked:!1}))),n.on("click",()=>l({supported:!0,clicked:!0})),n.on("action",(c,d)=>l({supported:!0,clicked:!0,actionIndex:d})),n.on("close",()=>l({supported:!0,clicked:!1})),n.on("failed",()=>l({supported:!1,clicked:!1})),n.show()})}async clearToast(e,t){this.activeToasts.deleteAndDispose(t)}async clearToasts(){this.activeToasts.clearAndDisposeAll()}async windowsGetStringRegKey(e,t,n,i){if(!M)return;let s=await import("@vscode/windows-registry");try{return s.GetStringRegKey(t,n,i)}catch{return}}async createZipFile(e,t,n){await vE(t.fsPath,n)}async getSystemIdleState(e,t){return bn.getSystemIdleState(t)}async getSystemIdleTime(e){return bn.getSystemIdleTime()}async getCurrentThermalState(e){return bn.getCurrentThermalState()}async isOnBatteryPower(e){return bn.isOnBatteryPower()}async startPowerSaveBlocker(e,t){return nI.start(t)}async stopPowerSaveBlocker(e,t){return nI.stop(t)}async isPowerSaveBlockerStarted(e,t){return nI.isStarted(t)}windowById(e,t){return this.codeWindowById(e)??this.auxiliaryWindowById(e)??this.codeWindowById(t)}codeWindowById(e){if(typeof e=="number")return this.windowsMainService.getWindowById(e)}auxiliaryWindowById(e){if(typeof e!="number")return;let t=xL.fromId(e);if(t)return this.auxiliaryWindowsMainService.getWindowByWebContents(t)}};T([de],ia.prototype,"cliPath",1),ia=T([g(0,Le),g(1,In),g(2,wn),g(3,me),g(4,Te),g(5,O),g(6,_e),g(7,Pi),g(8,dn),g(9,ge),g(10,Ln),g(11,gu),g(12,Vt)],ia)});var oe,os,lo=w(()=>{We();Z();oe={Uninitialized:{type:"uninitialized"},Disabled:o=>({type:"disabled",reason:o}),Idle:(o,r)=>({type:"idle",updateType:o,error:r}),CheckingForUpdates:o=>({type:"checking for updates",explicit:o}),AvailableForDownload:o=>({type:"available for download",update:o}),Downloading:(o,r,e,t,n,i)=>({type:"downloading",update:o,explicit:r,overwrite:e,downloadedBytes:t,totalBytes:n,startTime:i}),Downloaded:(o,r,e)=>({type:"downloaded",update:o,explicit:r,overwrite:e}),Updating:(o,r,e)=>({type:"updating",update:o,currentProgress:r,maxProgress:e}),Ready:(o,r,e)=>({type:"ready",update:o,explicit:r,overwrite:e}),Overwriting:(o,r)=>({type:"overwriting",update:o,explicit:r})},os=W("updateService")});import{app as oa}from"electron";var ss,yr,qu=w(()=>{zt();he();Q();Ji();K();ze();Y();yt();se();jt();Ce();Z();xt();re();Hs();hu();Lm();hr();jo();Lr();js();Ot();ss=W("workspacesHistoryMainService"),yr=class extends C{constructor(e,t,n,i,s,a){super();this.logService=e;this.workspacesManagementMainService=t;this.lifecycleMainService=n;this.applicationStorageMainService=i;this.dialogMainService=s;this.environmentMainService=a;this._onDidChangeRecentlyOpened=this._register(new x);this.onDidChangeRecentlyOpened=this._onDidChangeRecentlyOpened.event;this.macOSRecentDocumentsUpdater=this._register(new Pr(800));this.registerListeners()}static{this.MAX_TOTAL_RECENT_ENTRIES=500}static{this.RECENTLY_OPENED_STORAGE_KEY="history.recentlyOpenedPathsList"}registerListeners(){this.lifecycleMainService.when(4).then(()=>this.handleWindowsJumpList()),this._register(this.workspacesManagementMainService.onDidEnterWorkspace(e=>this.addRecentlyOpened([{workspace:e.workspace,remoteAuthority:e.window.remoteAuthority}])))}async addRecentlyOpened(e){let t=[],n=[];for(let s of e)if(Wm(s))!this.workspacesManagementMainService.isUntitledWorkspace(s.workspace)&&!this.containsWorkspace(t,s.workspace)&&t.push(s);else if(xu(s))this.containsFolder(t,s.folderUri)||t.push(s);else{let a=this.containsFile(n,s.fileUri),l=s.fileUri.scheme===N.file&&yr.COMMON_FILES_FILTER.indexOf(Kr(s.fileUri))>=0;!a&&!l&&(n.push(s),M&&s.fileUri.scheme===N.file&&!this.environmentMainService.isPortable&&oa.addRecentDocument(s.fileUri.fsPath))}let i=await this.mergeEntriesFromStorage({workspaces:t,files:n});t=i.workspaces,n=i.files,t.length>yr.MAX_TOTAL_RECENT_ENTRIES&&(t.length=yr.MAX_TOTAL_RECENT_ENTRIES),n.length>yr.MAX_TOTAL_RECENT_ENTRIES&&(n.length=yr.MAX_TOTAL_RECENT_ENTRIES),await this.saveRecentlyOpened({workspaces:t,files:n}),this._onDidChangeRecentlyOpened.fire(),V&&!this.environmentMainService.isPortable&&this.macOSRecentDocumentsUpdater.trigger(()=>this.updateMacOSRecentDocuments())}async removeRecentlyOpened(e){let t=a=>{let l=this.location(a);for(let c of e)if(Ge.isEqual(c,l))return!1;return!0},n=await this.getRecentlyOpened(),i=n.workspaces.filter(t),s=n.files.filter(t);(i.length!==n.workspaces.length||s.length!==n.files.length)&&(await this.saveRecentlyOpened({files:s,workspaces:i}),this._onDidChangeRecentlyOpened.fire(),V&&!this.environmentMainService.isPortable&&this.macOSRecentDocumentsUpdater.trigger(()=>this.updateMacOSRecentDocuments()))}async clearRecentlyOpened(e){if(e?.confirm){let{response:t}=await this.dialogMainService.showMessageBox({type:"warning",buttons:[h(2757,null),h(2756,null)],message:h(2759,null),detail:h(2758,null),cancelId:1});if(t!==0)return}await this.saveRecentlyOpened({workspaces:[],files:[]}),this.environmentMainService.isPortable||oa.clearRecentDocuments(),this._onDidChangeRecentlyOpened.fire()}async getRecentlyOpened(){return this.mergeEntriesFromStorage()}async mergeEntriesFromStorage(e){let t=new gt(s=>Ge.getComparisonKey(s));if(e?.workspaces)for(let s of e.workspaces)t.set(this.location(s),s);let n=new gt(s=>Ge.getComparisonKey(s));if(e?.files)for(let s of e.files)n.set(this.location(s),s);let i=await this.getRecentlyOpenedFromStorage();for(let s of i.workspaces){let a=t.get(this.location(s));a?a.label=a.label??s.label:t.set(this.location(s),s)}for(let s of i.files){let a=n.get(this.location(s));a?a.label=a.label??s.label:n.set(this.location(s),s)}return{workspaces:[...t.values()],files:[...n.values()]}}async getRecentlyOpenedFromStorage(){await this.applicationStorageMainService.whenReady;let e,t=this.applicationStorageMainService.get(yr.RECENTLY_OPENED_STORAGE_KEY,-1);if(typeof t=="string")try{e=JSON.parse(t)}catch(n){this.logService.error("Unexpected error parsing opened paths list",n)}return OP(e,this.logService)}async saveRecentlyOpened(e){await this.applicationStorageMainService.whenReady,this.applicationStorageMainService.store(yr.RECENTLY_OPENED_STORAGE_KEY,JSON.stringify(FP(e)),-1,1)}location(e){return xu(e)?e.folderUri:RP(e)?e.fileUri:e.workspace.configPath}containsWorkspace(e,t){return!!e.find(n=>Wm(n)&&n.workspace.id===t.id)}containsFolder(e,t){return!!e.find(n=>xu(n)&&Ge.isEqual(n.folderUri,t))}containsFile(e,t){return!!e.find(n=>Ge.isEqual(n.fileUri,t))}static{this.MAX_MACOS_DOCK_RECENT_WORKSPACES=7}static{this.MAX_MACOS_DOCK_RECENT_ENTRIES_TOTAL=10}static{this.MAX_WINDOWS_JUMP_LIST_ENTRIES=7}static{this.COMMON_FILES_FILTER=["COMMIT_EDITMSG","MERGE_MSG","git-rebase-todo"]}async handleWindowsJumpList(){M&&(this.environmentMainService.isPortable||(await this.updateWindowsJumpList(),this._register(this.onDidChangeRecentlyOpened(()=>this.updateWindowsJumpList()))))}async updateWindowsJumpList(){if(!M)return;let e=[];if(e.push({type:"tasks",items:[{type:"task",title:h(2760,null),description:h(2761,null),program:process.execPath,args:"-n",iconPath:process.execPath,iconIndex:0}]}),(await this.getRecentlyOpened()).workspaces.length>0){let t=[];for(let s of oa.getJumpListSettings().removedItems){let a=s.args;if(a){let l=/^--(folder|file)-uri\s+"([^"]+)"$/.exec(a);l&&t.push(b.parse(l[2]))}}await this.removeRecentlyOpened(t);let n=!1,i=at((await this.getRecentlyOpened()).workspaces.slice(0,yr.MAX_WINDOWS_JUMP_LIST_ENTRIES).map(s=>{let a=Wm(s)?s.workspace:s.folderUri,{title:l,description:c}=this.getWindowsJumpListLabel(a,s.label),d;return b.isUri(a)?d=`--folder-uri "${a.toString()}"`:(n=!0,d=`--file-uri "${a.configPath.toString()}"`),{type:"task",title:l.substr(0,255),description:c.substr(0,255),program:process.execPath,args:d,iconPath:"explorer.exe",iconIndex:0}}));i.length>0&&e.push({type:"custom",name:n?h(2763,null):h(2762,null),items:i})}e.push({type:"recent"});try{let t=oa.setJumpList(e);t&&t!=="ok"&&this.logService.warn(`updateWindowsJumpList#setJumpList unexpected result: ${t}`)}catch(t){this.logService.warn("updateWindowsJumpList#setJumpList",t)}}getWindowsJumpListLabel(e,t){if(t)return{title:z1(t).name,description:t};if(b.isUri(e))return{title:Kr(e),description:this.renderJumpListPathDescription(e)};if(this.workspacesManagementMainService.isUntitledWorkspace(e))return{title:h(2764,null),description:""};let n=Kr(e.configPath);return n.endsWith(su)&&(n=n.substr(0,n.length-su.length-1)),{title:h(2765,null,n),description:this.renderJumpListPathDescription(e.configPath)}}renderJumpListPathDescription(e){return e.scheme==="file"?Cd(e.fsPath):e.toString()}async updateMacOSRecentDocuments(){if(!V)return;oa.clearRecentDocuments();let e=await this.getRecentlyOpened(),t=[],n=0;for(let s=0;s<e.workspaces.length&&n<yr.MAX_MACOS_DOCK_RECENT_WORKSPACES;s++){let a=this.location(e.workspaces[s]);if(a.scheme===N.file){let l=ur(a);await q.exists(l)&&(t.push(l),n++)}}let i=[];for(let s=0;s<e.files.length&&n<yr.MAX_MACOS_DOCK_RECENT_ENTRIES_TOTAL;s++){let a=this.location(e.files[s]);if(a.scheme===N.file){let l=ur(a);if(yr.COMMON_FILES_FILTER.includes(Kr(a))||t.includes(l))continue;await q.exists(l)&&(i.push(l),n++)}}i.reverse().forEach(s=>oa.addRecentDocument(s)),t.reverse().forEach(s=>oa.addRecentDocument(s))}};yr=T([g(0,O),g(1,dn),g(2,me),g(3,zo),g(4,wn),g(5,Te)],yr)});var zu,sI=w(()=>{Z();zu=W("windsurfKeybindingMainService")});import{app as WL,BrowserWindow as Ih,dialog as LL,Menu as Xt,MenuItem as Qe}from"electron";function co(){return new Qe({type:"separator"})}var bh,uo,DE=w(()=>{he();St();Ji();Y();se();Ce();Qs();st();Ot();xt();re();nE();$u();Qt();Jr();ir();lo();no();Wt();qu();K();sI();bh="menu",uo=class extends C{constructor(e,t,n,i,s,a,l,c,d,u,f,m,y){super();this.updateService=e;this.configurationService=t;this.windowsMainService=n;this.environmentMainService=i;this.telemetryService=s;this.workspacesHistoryMainService=a;this.stateService=l;this.lifecycleMainService=c;this.logService=d;this.nativeHostMainService=u;this.productService=f;this.auxiliaryWindowsMainService=m;this.windsurfKeybindingMainService=y;this.fallbackMenuHandlers=Object.create(null);this.menuUpdater=this._register(new pr(()=>this.doUpdateMenu(),0)),this.menuGC=this._register(new pr(()=>{this.oldMenus=[]},1e4)),this.menubarMenus=Object.create(null),this.keybindings=Object.create(null),this.showNativeMenu=Py(t),(V||this.showNativeMenu)&&this.restoreCachedMenubarData(),this.addFallbackHandlers(),this.closedLastWindow=!1,this.noActiveMainWindow=!1,this.oldMenus=[],this.install(),this.registerListeners()}static{this.lastKnownMenubarStorageKey="lastKnownMenubarData"}restoreCachedMenubarData(){let e=this.stateService.getItem(uo.lastKnownMenubarStorageKey);e&&(e.menus&&(this.menubarMenus=e.menus),e.keybindings&&(this.keybindings=e.keybindings))}addFallbackHandlers(){this.fallbackMenuHandlers["workbench.action.files.newUntitledFile"]=(a,l,c)=>{this.runActionInRenderer({type:"commandId",commandId:"workbench.action.files.newUntitledFile"})||this.windowsMainService.openEmptyWindow({context:2,contextWindowId:l?.id})},this.fallbackMenuHandlers["workbench.action.newWindow"]=(a,l,c)=>this.windowsMainService.openEmptyWindow({context:2,contextWindowId:l?.id}),this.fallbackMenuHandlers["workbench.action.files.openFileFolder"]=(a,l,c)=>this.nativeHostMainService.pickFileFolderAndOpen(void 0,{forceNewWindow:this.isOptionClick(c),telemetryExtraData:{from:bh}}),this.fallbackMenuHandlers["workbench.action.files.openFolder"]=(a,l,c)=>this.nativeHostMainService.pickFolderAndOpen(void 0,{forceNewWindow:this.isOptionClick(c),telemetryExtraData:{from:bh}}),this.fallbackMenuHandlers["workbench.action.openWorkspace"]=(a,l,c)=>this.nativeHostMainService.pickWorkspaceAndOpen(void 0,{forceNewWindow:this.isOptionClick(c),telemetryExtraData:{from:bh}}),this.fallbackMenuHandlers["workbench.action.clearRecentFiles"]=()=>this.workspacesHistoryMainService.clearRecentlyOpened({confirm:!0});let e=this.productService.youTubeUrl;e&&(this.fallbackMenuHandlers["workbench.action.openYouTubeUrl"]=()=>this.openUrl(e,"openYouTubeUrl"));let t=this.productService.requestFeatureUrl;t&&(this.fallbackMenuHandlers["workbench.action.openRequestFeatureUrl"]=()=>this.openUrl(t,"openUserVoiceUrl"));let n=this.productService.reportIssueUrl;n&&(this.fallbackMenuHandlers["workbench.action.openIssueReporter"]=()=>this.openUrl(n,"openReportIssues"));let i=this.productService.licenseUrl;i&&(this.fallbackMenuHandlers["workbench.action.openLicenseUrl"]=()=>{if(fn){let a=i.indexOf("?")>0?"&":"?";this.openUrl(`${i}${a}lang=${fn}`,"openLicenseUrl")}else this.openUrl(i,"openLicenseUrl")});let s=this.productService.privacyStatementUrl;s&&i&&(this.fallbackMenuHandlers["workbench.action.openPrivacyStatementUrl"]=()=>{this.openUrl(s,"openPrivacyStatement")})}registerListeners(){this._register(this.lifecycleMainService.onWillShutdown(()=>this.willShutdown=!0)),this._register(this.windowsMainService.onDidChangeWindowsCount(e=>this.onDidChangeWindowsCount(e))),this._register(this.nativeHostMainService.onDidBlurMainWindow(()=>this.onDidChangeWindowFocus())),this._register(this.nativeHostMainService.onDidFocusMainWindow(()=>this.onDidChangeWindowFocus()))}get currentEnableMenuBarMnemonics(){let e=this.configurationService.getValue("window.enableMenuBarMnemonics");return typeof e!="boolean"?!0:e}get currentEnableNativeTabs(){if(!V)return!1;let e=this.configurationService.getValue("window.nativeTabs");return typeof e!="boolean"?!1:e}updateMenu(e,t){this.menubarMenus=e.menus,this.keybindings=e.keybindings,this.stateService.setItem(uo.lastKnownMenubarStorageKey,e),this.scheduleUpdateMenu()}scheduleUpdateMenu(){this.menuUpdater.schedule()}doUpdateMenu(){this.willShutdown||setTimeout(()=>{this.willShutdown||this.install()},10)}onDidChangeWindowsCount(e){V&&(e.oldCount===0&&e.newCount>0||e.oldCount>0&&e.newCount===0)&&(this.closedLastWindow=e.newCount===0,this.scheduleUpdateMenu())}onDidChangeWindowFocus(){if(!V)return;let e=Ih.getFocusedWindow();this.noActiveMainWindow=!e||!!this.auxiliaryWindowsMainService.getWindowByWebContents(e.webContents),this.scheduleUpdateMenu()}install(){let e=Xt.getApplicationMenu();if(e&&this.oldMenus.push(e),Object.keys(this.menubarMenus).length===0){this.doSetApplicationMenu(V?new Xt:null);return}let t=new Xt,n;if(V){let s=new Xt;n=new Qe({label:this.productService.nameShort,submenu:s}),this.setMacApplicationMenu(s),t.append(n)}if(V&&!this.appMenuInstalled){this.appMenuInstalled=!0;let s=new Xt;s.append(new Qe({label:this.mnemonicLabel(h(2184,null)),click:()=>this.windowsMainService.openEmptyWindow({context:1})})),WL.dock.setMenu(s)}if(this.shouldDrawMenu("File")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2173,null)),submenu:s});this.setMenuById(s,"File"),t.append(a)}if(this.shouldDrawMenu("Edit")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2172,null)),submenu:s});this.setMenuById(s,"Edit"),t.append(a)}if(this.shouldDrawMenu("Selection")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2194,null)),submenu:s});this.setMenuById(s,"Selection"),t.append(a)}if(this.shouldDrawMenu("View")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2200,null)),submenu:s});this.setMenuById(s,"View"),t.append(a)}if(this.shouldDrawMenu("Go")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2174,null)),submenu:s});this.setMenuById(s,"Go"),t.append(a)}if(this.shouldDrawMenu("Run")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2193,null)),submenu:s});this.setMenuById(s,"Run"),t.append(a)}if(this.shouldDrawMenu("Terminal")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2199,null)),submenu:s});this.setMenuById(s,"Terminal"),t.append(a)}let i;if(this.shouldDrawMenu("Window")){let s=new Xt;i=new Qe({label:this.mnemonicLabel(h(2201,null)),submenu:s,role:"window"}),this.setMacWindowMenu(s)}if(i&&t.append(i),this.shouldDrawMenu("Help")){let s=new Xt,a=new Qe({label:this.mnemonicLabel(h(2175,null)),submenu:s,role:"help"});this.setMenuById(s,"Help"),t.append(a)}t.items&&t.items.length>0?this.doSetApplicationMenu(t):this.doSetApplicationMenu(null),this.menuGC.schedule()}doSetApplicationMenu(e){if(Xt.setApplicationMenu(e),e)for(let t of this.auxiliaryWindowsMainService.getWindows())t.win?.setMenu(null)}setMacApplicationMenu(e){let t=this.createMenuItem(h(2170,null,this.productService.nameLong),"workbench.action.showAboutDialog"),n=this.getUpdateMenuItems(),i;if(this.shouldDrawMenu("Preferences")){let m=new Xt;this.setMenuById(m,"Preferences"),i=new Qe({label:this.mnemonicLabel(h(2185,null)),submenu:m})}let s=new Xt,a=new Qe({label:h(2195,null),role:"services",submenu:s}),l=new Qe({label:h(2176,null,this.productService.nameLong),role:"hide",accelerator:"Command+H"}),c=new Qe({label:h(2177,null),role:"hideOthers",accelerator:"Command+Alt+H"}),d=new Qe({label:h(2196,null),role:"unhide"}),u=new Qe(this.likeAction("workbench.action.quit",{label:h(2186,null,this.productService.nameLong),click:async(m,y,v)=>{let S=this.windowsMainService.getLastActiveWindow();(this.windowsMainService.getWindowCount()===0||Ih.getFocusedWindow()||S?.win?.isMinimized())&&await this.confirmBeforeQuit(v)&&this.nativeHostMainService.quit(void 0)}})),f=[t];f.push(...n),i&&f.push(co(),i),f.push(co(),a,co(),l,c,d,co(),u),f.forEach(m=>e.append(m))}async confirmBeforeQuit(e){if(this.windowsMainService.getWindowCount()===0)return!0;let t=this.configurationService.getValue("window.confirmBeforeClose");if(t==="always"||t==="keyboardOnly"&&this.isKeyboardEvent(e)){let{response:n}=await this.nativeHostMainService.showMessageBox(this.windowsMainService.getFocusedWindow()?.id,{type:"question",buttons:[V?h(2203,null):h(2169,null),h(2166,null)],message:V?h(2205,null):h(2204,null)});return n===0}return!0}shouldDrawMenu(e){if(!V&&!this.showNativeMenu)return!1;switch(e){case"File":case"Help":if(V)return this.windowsMainService.getWindowCount()===0&&this.closedLastWindow||this.windowsMainService.getWindowCount()>0&&this.noActiveMainWindow||!!this.menubarMenus&&!!this.menubarMenus[e];case"Window":if(V)return this.windowsMainService.getWindowCount()===0&&this.closedLastWindow||this.windowsMainService.getWindowCount()>0&&this.noActiveMainWindow||!!this.menubarMenus;default:return this.windowsMainService.getWindowCount()>0&&!!this.menubarMenus&&!!this.menubarMenus[e]}}setMenu(e,t){t.forEach(n=>{if(qw(n))e.append(co());else if($w(n)){let i=new Xt,s=new Qe({label:this.mnemonicLabel(n.label),submenu:i});this.setMenu(i,n.submenu.items),e.append(s)}else zw(n)?e.append(this.createOpenRecentMenuItem(n)):rE(n)&&(n.id==="workbench.action.showAboutDialog"&&this.insertCheckForUpdatesItems(e),V?this.windowsMainService.getWindowCount()===0&&this.closedLastWindow||this.windowsMainService.getWindowCount()>0&&this.noActiveMainWindow?this.fallbackMenuHandlers[n.id]?e.append(new Qe(this.likeAction(n.id,{label:this.mnemonicLabel(n.label),click:this.fallbackMenuHandlers[n.id]}))):e.append(this.createMenuItem(n.label,n.id,!1,n.checked)):e.append(this.createMenuItem(n.label,n.id,n.enabled!==!1,!!n.checked)):e.append(this.createMenuItem(n.label,n.id,n.enabled!==!1,!!n.checked)))})}setMenuById(e,t){this.menubarMenus?.[t]&&this.setMenu(e,this.menubarMenus[t].items)}insertCheckForUpdatesItems(e){let t=this.getUpdateMenuItems();t.length&&(t.forEach(n=>e.append(n)),e.append(co()))}createOpenRecentMenuItem(e){let t=b.revive(e.uri),n=e.id,i=n==="openRecentFile"?{fileUri:t}:n==="openRecentWorkspace"?{workspaceUri:t}:{folderUri:t};return new Qe(this.likeAction(n,{label:e.label,click:async(s,a,l)=>{let c=this.isOptionClick(l);(await this.windowsMainService.open({context:2,cli:this.environmentMainService.args,urisToOpen:[i],forceNewWindow:c,gotoLineMode:!1,remoteAuthority:e.remoteAuthority})).length>0||await this.workspacesHistoryMainService.removeRecentlyOpened([t])}},!1))}isOptionClick(e){return!!(e&&(!V&&(e.ctrlKey||e.shiftKey)||V&&(e.metaKey||e.altKey)))}isKeyboardEvent(e){return!!(e.triggeredByAccelerator||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}createRoleMenuItem(e,t,n){let i={label:this.mnemonicLabel(e),role:n,enabled:!0};return new Qe(this.withKeybinding(t,i))}setMacWindowMenu(e){let t=new Qe({label:h(2190,null),role:"minimize",accelerator:"Command+M",enabled:this.windowsMainService.getWindowCount()>0}),n=new Qe({label:h(2202,null),role:"zoom",enabled:this.windowsMainService.getWindowCount()>0}),i=new Qe({label:h(2171,null),role:"front",enabled:this.windowsMainService.getWindowCount()>0}),s=this.createMenuItem(h(2188,null),"workbench.action.switchWindow"),a=[];this.currentEnableNativeTabs&&(a.push(co()),a.push(this.createMenuItem(h(2192,null),"workbench.action.newWindowTab")),a.push(this.createRoleMenuItem(h(2198,null),"workbench.action.showPreviousWindowTab","selectPreviousTab")),a.push(this.createRoleMenuItem(h(2197,null),"workbench.action.showNextWindowTab","selectNextTab")),a.push(this.createRoleMenuItem(h(2191,null),"workbench.action.moveWindowTabToNewWindow","moveTabToNewWindow")),a.push(this.createRoleMenuItem(h(2189,null),"workbench.action.mergeAllWindowTabs","mergeAllWindows"))),[t,n,co(),s,...a,co(),i].forEach(l=>e.append(l))}getUpdateMenuItems(){let e=this.updateService.state;switch(e.type){case"idle":return[new Qe({label:this.mnemonicLabel(h(2178,null)),click:()=>setTimeout(()=>{this.reportMenuActionTelemetry("CheckForUpdate"),this.updateService.checkForUpdates(!0)},0)})];case"checking for updates":return[new Qe({label:h(2179,null),enabled:!1})];case"available for download":return[new Qe({label:this.mnemonicLabel(h(2181,null)),click:()=>{this.updateService.downloadUpdate(!0)}})];case"downloading":case"overwriting":return[new Qe({label:h(2180,null),enabled:!1})];case"downloaded":return V?[]:[new Qe({label:this.mnemonicLabel(h(2183,null)),click:async()=>{this.reportMenuActionTelemetry("InstallUpdate"),!this.runActionInRenderer({type:"commandId",commandId:"update.install"})&&await this.confirmUpdateInMainProcess(e.update)&&this.updateService.applyUpdate()}})];case"updating":return[new Qe({label:h(2182,null),enabled:!1})];case"ready":return[new Qe({label:this.mnemonicLabel(e.update.restartUpdateMessage||h(2187,null)),click:async()=>{this.reportMenuActionTelemetry("RestartToUpdate"),!this.runActionInRenderer({type:"commandId",commandId:"update.restart"})&&await this.confirmUpdateInMainProcess(e.update)&&this.updateService.quitAndInstall()}})];default:return[]}}createMenuItem(e,t,n,i){let s=this.mnemonicLabel(e),a=(u,f,m)=>{let y=u?u.userSettingsLabel:null;y&&m.triggeredByAccelerator?(this.windsurfKeybindingMainService.setIsMenuAction(y,!0),this.runActionInRenderer({type:"keybinding",userSettingsLabel:y})):this.runActionInRenderer({type:"commandId",commandId:t})},l=typeof n=="boolean"?n:this.windowsMainService.getWindowCount()>0,c=typeof i=="boolean"?i:!1,d={label:s,click:a,enabled:l};return c&&(d.type="checkbox",d.checked=c),V&&(t==="editor.action.clipboardCutAction"?d.role="cut":t==="editor.action.clipboardCopyAction"?d.role="copy":t==="editor.action.clipboardPasteAction"&&(d.role="paste"),t==="undo"?d.click=this.makeContextAwareClickHandler(a,{inDevTools:u=>u.undo(),inNoWindow:()=>Xt.sendActionToFirstResponder("undo:")}):t==="redo"?d.click=this.makeContextAwareClickHandler(a,{inDevTools:u=>u.redo(),inNoWindow:()=>Xt.sendActionToFirstResponder("redo:")}):t==="editor.action.selectAll"&&(d.click=this.makeContextAwareClickHandler(a,{inDevTools:u=>u.selectAll(),inNoWindow:()=>Xt.sendActionToFirstResponder("selectAll:")}))),new Qe(this.withKeybinding(t,d))}makeContextAwareClickHandler(e,t){return(n,i,s)=>{let a=Ih.getFocusedWindow();if(!a)return t.inNoWindow();if(a.webContents.isDevToolsFocused()&&a.webContents.devToolsWebContents)return t.inDevTools(a.webContents.devToolsWebContents);if(!a.webContents.isFocused())return t.inNoWindow();e(n,i||a,s)}}async confirmUpdateInMainProcess(e){let t=e.restartUpdateMessage?e.restartUpdateConfirmationMessage:void 0;if(!t)return!0;let n=h(2168,null),i=h(2167,null);return(await LL.showMessageBox({type:"warning",message:t,buttons:[n,i],defaultId:0,cancelId:1})).response===0}runActionInRenderer(e){let t=Ih.getFocusedWindow();if(t){let i=this.auxiliaryWindowsMainService.getWindowByWebContents(t.webContents);i&&(t=this.windowsMainService.getWindowById(i.parentId)?.win??null)}if(!t){let i=this.windowsMainService.getLastActiveWindow();i?.win?.isMinimized()&&(t=i.win)}let n=t?this.windowsMainService.getWindowById(t.id):void 0;if(n){if(this.logService.trace("menubar#runActionInRenderer",e),V&&!this.environmentMainService.isBuilt&&!n.isReady&&(e.type==="commandId"&&e.commandId==="workbench.action.toggleDevTools"||e.type!=="commandId"&&e.userSettingsLabel==="alt+cmd+i"))return!1;if(e.type==="commandId"){let i={id:e.commandId,from:"menu"};n.sendWhenReady("vscode:runAction",be.None,i)}else{let i={userSettingsLabel:e.userSettingsLabel};n.sendWhenReady("vscode:runKeybinding",be.None,i)}return!0}else return this.logService.trace("menubar#runActionInRenderer: no active window found",e),!1}withKeybinding(e,t){let n=typeof e=="string"?this.keybindings[e]:void 0;if(n?.label){if(n.isNative!==!1)t.accelerator=n.label,t.userSettingsLabel=n.userSettingsLabel;else if(typeof t.label=="string"){let i=t.label.indexOf("[");i>=0?t.label=`${t.label.substr(0,i)} [${n.label}]`:t.label=`${t.label} [${n.label}]`}}else t.accelerator=void 0;return t}likeAction(e,t,n=!t.accelerator){n&&(t=this.withKeybinding(e,t));let i=t.click;return t.click=(s,a,l)=>{this.reportMenuActionTelemetry(e),i?.(s,a,l)},t}openUrl(e,t){this.nativeHostMainService.openExternal(void 0,e),this.reportMenuActionTelemetry(t)}reportMenuActionTelemetry(e){this.telemetryService.publicLog2("workbenchActionExecuted",{id:e,from:bh})}mnemonicLabel(e){return q1(e,!this.currentEnableMenuBarMnemonics)}};uo=T([g(0,os),g(1,ge),g(2,Le),g(3,Te),g(4,ot),g(5,ss),g(6,ft),g(7,me),g(8,O),g(9,Di),g(10,_e),g(11,In),g(12,zu)],uo)});var aI,jl,WE=w(()=>{Z();xt();re();DE();K();aI=W("menubarMainService"),jl=class extends C{constructor(e,t,n){super();this.instantiationService=e;this.lifecycleMainService=t;this.logService=n;this.menubar=this.installMenuBarAfterWindowOpen()}async installMenuBarAfterWindowOpen(){return await this.lifecycleMainService.when(3),this._register(this.instantiationService.createInstance(uo))}async updateMenubar(e,t){this.logService.trace("menubarService#updateMenubar",e),(await this.menubar).updateMenu(t,e)}};jl=T([g(0,Vt),g(1,me),g(2,O)],jl)});var Qr,lI,Sh,as=w(()=>{Q();K();Z();Qr=W("meteredConnectionService"),lI="network.meteredConnection",Sh=class extends C{constructor(e,t){super();this._onDidChangeIsConnectionMetered=this._register(new x);this.onDidChangeIsConnectionMetered=this._onDidChangeIsConnectionMetered.event;this._isBrowserConnectionMetered=t,this._meteredConnectionSetting=e.getValue(lI),this._isConnectionMetered=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered,this._register(e.onDidChangeConfiguration(n=>{if(n.affectsConfiguration(lI)){let i=e.getValue(lI);i!==this._meteredConnectionSetting&&(this._meteredConnectionSetting=i,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 cI,dI=w(()=>{Q();K();cI="meteredConnection"});var xh,LE=w(()=>{dI();xh=class{constructor(r){this.service=r}listen(r,e){if(e==="OnDidChangeIsConnectionMetered")return this.service.onDidChangeIsConnectionMetered;throw new Error(`Event not found: ${e}`)}async call(r,e,t){switch(e){case"IsConnectionMetered":return this.service.isConnectionMetered;case"SetIsBrowserConnectionMetered":this.service.setIsBrowserConnectionMetered(t);break;default:throw new Error(`Call not found: ${e}`)}}}});var Jl,AE=w(()=>{st();as();Jl=class extends Sh{constructor(r){super(r,!1)}setTelemetryService(r){this.telemetryService=r}onChangeBrowserConnection(){let r=this.isBrowserConnectionMetered;r||super.onChangeBrowserConnection(),this.telemetryService?.publicLog2("meteredConnectionStateChange",{connectionState:this.isBrowserConnectionMetered}),r&&super.onChangeBrowserConnection()}};Jl=T([g(0,ge)],Jl)});var An,sa,Ql,ri=w(()=>{Q();sd();K();Z();An=W("policy"),sa=class extends C{constructor(){super(...arguments);this.policyDefinitions={};this.policies=new Map;this._onDidChange=this._register(new x);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),pi.reduce(this.policies.entries(),(n,[i,s])=>({...n,[i]:s}),{})}getPolicyValue(e){return this.policies.get(e)}serialize(){return pi.reduce(Object.entries(this.policyDefinitions),(e,[t,n])=>({...e,[t]:{definition:n,value:this.policies.get(t)}}),{})}},Ql=class{constructor(){this.onDidChange=E.None;this.policyDefinitions={}}async updatePolicyDefinitions(){return{}}getPolicyValue(){}serialize(){}}});async function AL(o,r,e,t,n){try{let i=await import("@vscode/spdlog");i.setFlushOn(0);let s=await i.createAsyncRotatingLogger(o,r,e,t);return n?s.clearFormatters():s.setPattern("%Y-%m-%d %H:%M:%S.%e [%l] %v"),s}catch(i){console.error(i)}return null}function ME(o,r,e){switch(r){case 1:o.trace(e);break;case 2:o.debug(e);break;case 3:o.info(e);break;case 4:o.warn(e);break;case 5:o.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${r}`)}}function OE(o,r){switch(r){case 1:o.setLevel(0);break;case 2:o.setLevel(1);break;case 3:o.setLevel(2);break;case 4:o.setLevel(3);break;case 5:o.setLevel(4);break;case 0:o.setLevel(6);break;default:throw new Error(`Invalid log level ${r}`)}}var Ph,FE=w(()=>{je();re();Ph=class extends Us{constructor(e,t,n,i,s){super();this.buffer=[];this.setLevel(s),this._loggerCreationPromise=this._createSpdLogLogger(e,t,n,i),this._register(this.onDidChangeLogLevel(a=>{this._logger&&OE(this._logger,a)}))}async _createSpdLogLogger(e,t,n,i){let s=n?6:1,a=30/s*Ii.MB,l=await AL(e,t,a,s,i);if(l){this._logger=l,OE(this._logger,this.getLevel());for(let{level:c,message:d}of this.buffer)ME(this._logger,c,d);this.buffer=[]}}log(e,t){this._logger?ME(this._logger,e,t):this.getLevel()<=e&&this.buffer.push({level:e,message:t})}flush(){this._logger?this.flushLogger():this._loggerCreationPromise.then(()=>this.flushLogger())}dispose(){this._logger?this.disposeLogger():this._loggerCreationPromise.then(()=>this.disposeLogger()),super.dispose()}flushLogger(){this._logger&&this._logger.flush()}disposeLogger(){this._logger&&(this._logger.drop(),this._logger=void 0)}}});var Eh,UE=w(()=>{Mt();re();FE();Eh=class extends eu{doCreateLogger(r,e,t){return new Ph(xe(),r.fsPath,!t?.donotRotate,!!t?.donotUseFormatters,e)}}});var Wi,Th,Xl=w(()=>{Lr();Q();Z();re();UE();Wi=Fo,Th=class extends Eh{constructor(){super(...arguments);this.loggerResourcesByWindow=new gt}createLogger(e,t,n){n!==void 0&&this.loggerResourcesByWindow.set(this.toResource(e),n);try{return super.createLogger(e,t)}catch(i){throw this.loggerResourcesByWindow.delete(this.toResource(e)),i}}registerLogger(e,t){t!==void 0&&this.loggerResourcesByWindow.set(e.resource,t),super.registerLogger(e)}deregisterLogger(e){this.loggerResourcesByWindow.delete(e),super.deregisterLogger(e)}getGlobalLoggers(){let e=[];for(let t of super.getRegisteredLoggers())this.loggerResourcesByWindow.has(t.resource)||e.push(t);return e}getOnDidChangeLogLevelEvent(e){return E.filter(this.onDidChangeLogLevel,t=>tu(t)||this.isInterestedLoggerResource(t[0],e))}getOnDidChangeVisibilityEvent(e){return E.filter(this.onDidChangeVisibility,([t])=>this.isInterestedLoggerResource(t,e))}getOnDidChangeLoggersEvent(e){return E.filter(E.map(this.onDidChangeLoggers,t=>({added:[...t.added].filter(i=>this.isInterestedLoggerResource(i.resource,e)),removed:[...t.removed].filter(i=>this.isInterestedLoggerResource(i.resource,e))})),t=>t.added.length>0||t.removed.length>0)}deregisterLoggers(e){for(let[t,n]of this.loggerResourcesByWindow)n===e&&this.deregisterLogger(t)}isInterestedLoggerResource(e,t){let n=this.loggerResourcesByWindow.get(e);return n===void 0||n===t}dispose(){super.dispose(),this.loggerResourcesByWindow.clear()}}});function ML(o){if(Ni===2&&/^penguin(\.|$)/i.test(o))return"chromebook"}function NE(o,r,e,t,n,i,s,a,l,c,d){let u=Object.create(null);u["common.machineId"]=i,u["common.sqmId"]=s,u["common.devDeviceId"]=a,u.sessionID=xe()+Date.now(),u.commitHash=t,u.version=n,u["common.releaseDate"]=c,u["common.platformVersion"]=(o||"").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/,"$1$2$3"),u["common.platform"]=Rp(Ni),u["common.nodePlatform"]=Lp,u["common.nodeArch"]=e,u["common.product"]=d||"desktop",l&&(u["common.msftInternal"]=l);let f=0,m=Date.now();Object.defineProperties(u,{timestamp:{get:()=>new Date,enumerable:!0},"common.timesincesessionstart":{get:()=>Date.now()-m,enumerable:!0},"common.sequence":{get:()=>f++,enumerable:!0}}),Dp&&(u["common.snap"]="true");let y=ML(r);return y&&(u["common.platformDetail"]=y),u}function BE(o){let r=Sr.USERDNSDOMAIN;if(!r)return!1;let e=r.toLowerCase();return o.some(t=>e===t)}var uI=w(()=>{Y();Bn();Mt()});function _h(o,r){return!r.isBuilt&&!r.disableTelemetry?!0:!(r.disableTelemetry||!o.enableTelemetry)}function Yl(o){let r=o.getValue(hl),e=o.getValue(fm);if(o.getValue(du)===!1||e===!1)return 0;switch(r??"all"){case"all":return 3;case"error":return 2;case"crash":return 1;case"off":return 0}}function VE(o,r){let e=o.msftInternalDomains||[],t=r.getValue("telemetry.internalTesting");return BE(e)||t}function HE(o){return[o.appRoot,o.extensionsPath,o.userHome.fsPath,o.tmpDir.fsPath,o.userDataPath]}function NL(o,r){if(!o||!o.includes("/")&&!o.includes("\\"))return o;let e=o,t=[];for(let l of r)for(;;){let c=l.exec(o);if(!c)break;t.push([c.index,l.lastIndex])}let n=/^[\\\/]?(node_modules|node_modules\.asar)[\\\/]/,i=/^(.*?)((?:\.vscode(?:-[a-z]+)*|resources[\\\/]app)[\\\/]extensions[\\\/].*)$/i,s=/(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w-\._]+(\\\\|\\|\/))+[\w-\._]*/g,a=0;for(e="";;){let l=s.exec(o);if(!l)break;let c=t.some(([d,u])=>l.index<u&&d<s.lastIndex);if(!n.test(l[0])&&!c){let d=i.exec(l[0]);d?e+=o.substring(a,l.index)+"<REDACTED: user-file-path>/"+d[2]:e+=o.substring(a,l.index)+"<REDACTED: user-file-path>",a=s.lastIndex}}return a<o.length&&(e+=o.substr(a)),e}function BL(o){if(!o)return o;let r=[{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 r)if(e.regex.test(o))return`<REDACTED: ${e.label}>`;return o}function KE(o,r){return o?xP(o,e=>{if(e instanceof Ch||Object.hasOwnProperty.call(e,"isTrustedTelemetryValue"))return e.value;if(typeof e=="string"){let t=e.replaceAll("%20"," ");t=NL(t,r);for(let n of r)t=t.replace(n,"");return t=BL(t),t}}):{}}var Ch,pI,ls,UL,sne,cs=w(()=>{yn();We();Ce();Cl();uI();ir();Ch=class{constructor(r){this.value=r;this.isTrustedTelemetryValue=!0}},pI=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(){}},ls=new pI,UL="telemetry",sne={id:UL,name:h(2317,null)}});var kh,mI,hI,$E=w(()=>{kh={exit:"vscode:electron-main->shared-process=exit",ipcReady:"vscode:shared-process->electron-main=ipc-ready",initDone:"vscode:shared-process->electron-main=init-done"},mI={request:"vscode:createSharedProcessChannelConnection",response:"vscode:createSharedProcessChannelConnectionResult"},hI={request:"vscode:createSharedProcessRawConnection",response:"vscode:createSharedProcessRawConnectionResult"}});var Zl,qE=w(()=>{Qn();he();K();Ot();xt();re();Yn();ri();Xl();Js();cs();Bf();We();$E();Q();Zl=class extends C{constructor(e,t,n,i,s,a,l,c,d){super();this.machineId=e;this.sqmId=t;this.devDeviceId=n;this.environmentMainService=i;this.userDataProfilesService=s;this.lifecycleMainService=a;this.logService=l;this.loggerMainService=c;this.policyService=d;this.firstWindowConnectionBarrier=new mi;this.utilityProcess=void 0;this.utilityProcessLogListener=void 0;this._onDidCrash=this._register(new x);this.onDidCrash=this._onDidCrash.event;this._whenReady=void 0;this._whenIpcReady=void 0;this.registerListeners()}registerListeners(){ct.on(mI.request,(e,t)=>this.onWindowConnection(e,t,mI.response)),ct.on(hI.request,(e,t)=>this.onWindowConnection(e,t,hI.response)),this._register(this.lifecycleMainService.onWillShutdown(()=>this.onWillShutdown()))}async onWindowConnection(e,t,n){this.logService.trace(`[SharedProcess] onWindowConnection for: ${n}`),this.firstWindowConnectionBarrier.isOpen()||this.firstWindowConnectionBarrier.open(),await this.whenReady();let i=await this.connect(n);if(e.sender.isDestroyed())return i.close();e.sender.postMessage(n,t,[i])}onWillShutdown(){this.logService.trace("[SharedProcess] onWillShutdown"),this.utilityProcess?.postMessage(kh.exit),this.utilityProcess=void 0}whenReady(){return this._whenReady||(this._whenReady=(async()=>{await this.whenIpcReady;let e=new Gt;this.utilityProcess?.once(kh.initDone,()=>e.complete()),await e.p,this.utilityProcessLogListener?.dispose(),this.logService.trace("[SharedProcess] Overall ready")})()),this._whenReady}get whenIpcReady(){return this._whenIpcReady||(this._whenIpcReady=(async()=>{await this.firstWindowConnectionBarrier.wait(),this.createUtilityProcess();let e=new Gt;this.utilityProcess?.once(kh.ipcReady,()=>e.complete()),await e.p,this.logService.trace("[SharedProcess] IPC ready")})()),this._whenIpcReady}createUtilityProcess(){this.utilityProcess=this._register(new or(this.logService,ls,this.lifecycleMainService)),this.utilityProcessLogListener=this.utilityProcess.onMessage(n=>{let i=n;typeof i.warning=="string"?this.logService.warn(i.warning):typeof i.error=="string"&&this.logService.error(i.error)});let e=Ax(this.environmentMainService.args,this.environmentMainService.isBuilt),t;e.port&&(t=["--nolazy","--experimental-network-inspection"],e.break?t.push(`--inspect-brk=${e.port}`):t.push(`--inspect=${e.port}`)),this.utilityProcess.start({type:"shared-process",name:"shared-process",entryPoint:"vs/code/electron-utility/sharedProcess/sharedProcessMain",payload:this.createSharedProcessConfiguration(),respondToAuthRequestsFromMainProcess:!0,execArgv:t}),this._register(this.utilityProcess.onCrash(()=>this._onDidCrash.fire()))}createSharedProcessConfiguration(){return{machineId:this.machineId,sqmId:this.sqmId,devDeviceId:this.devDeviceId,codeCachePath:this.environmentMainService.codeCachePath,profiles:{home:this.userDataProfilesService.profilesHome,all:this.userDataProfilesService.profiles},args:this.environmentMainService.args,logLevel:this.loggerMainService.getLogLevel(),loggers:this.loggerMainService.getGlobalLoggers(),policiesData:this.policyService.serialize()}}async connect(e){return await this.whenIpcReady,ui(this.utilityProcess).connect(e)}};Zl=T([g(3,Te),g(4,_r),g(5,me),g(6,O),g(7,Wi),g(8,An)],Zl)});var VL,ds,Rh=w(()=>{Z();VL="signService",ds=W(VL)});var Dh,zE=w(()=>{Q();K();Dd();hr();Dh=class o extends C{constructor(e,t){super();this.logService=e;this.storageMainService=t;this.onDidChangeApplicationStorageEmitter=this._register(new x);this.mapProfileToOnDidChangeProfileStorageEmitter=new Map;this.registerStorageChangeListeners(t.applicationStorage,this.onDidChangeApplicationStorageEmitter)}static{this.STORAGE_CHANGE_DEBOUNCE_TIME=100}registerStorageChangeListeners(e,t){this._register(E.debounce(e.onDidChangeStorage,(n,i)=>(n?n.push(i):n=[i],n),o.STORAGE_CHANGE_DEBOUNCE_TIME)(n=>{n.length&&t.fire(this.serializeStorageChangeEvents(n,e))}))}serializeStorageChangeEvents(e,t){let n=new Map,i=new Set;return e.forEach(s=>{let a=t.get(s.key);typeof a=="string"?n.set(s.key,a):i.add(s.key)}),{changed:Array.from(n.entries()),deleted:Array.from(i.values())}}listen(e,t,n){switch(t){case"onDidChangeStorage":{let i=n.profile?Jn(n.profile):void 0;if(!i)return this.onDidChangeApplicationStorageEmitter.event;let s=this.mapProfileToOnDidChangeProfileStorageEmitter.get(i.id);return s||(s=this._register(new x),this.registerStorageChangeListeners(this.storageMainService.profileStorage(i),s),this.mapProfileToOnDidChangeProfileStorageEmitter.set(i.id,s)),s.event}}throw new Error(`Event not found: ${t}`)}async call(e,t,n){let i=n.profile?Jn(n.profile):void 0,s=zx(n.workspace),a=await this.withStorageInitialized(i,s);switch(t){case"getItems":return Array.from(a.items.entries());case"updateItems":{let l=n;if(l.insert)for(let[c,d]of l.insert)a.set(c,d);l.delete?.forEach(c=>a.delete(c));break}case"optimize":return a.optimize();case"isUsed":{let l=n.payload;return typeof l=="string"?this.storageMainService.isUsed(l):!1}default:throw new Error(`Call not found: ${t}`)}}async withStorageInitialized(e,t){let n;t?n=this.storageMainService.workspaceStorage(t):e?n=this.storageMainService.profileStorage(e):n=this.storageMainService.applicationStorage;try{await n.init()}catch(i){this.logService.error(`StorageIPC#init: Unable to init ${t?"workspace":e?"profile":"application"} storage due to ${i}`)}return n}}});var Wh,GE=w(()=>{Wh=class{constructor(r){this.channel=r}log(r,e){return this.channel.call("log",{eventName:r,data:e}).then(void 0,t=>`Failed to log telemetry: ${console.warn(t)}`),Promise.resolve(null)}flush(){return Promise.resolve()}}});function HL(){let o=h(2315,null,Er.nameLong,"https://windsurf.com/redirect/windsurf/settings"),r=h(2313,null,Er.nameLong),e=Er.privacyStatementUrl?h(2299,null,"https://aka.ms/vscode-telemetry",Er.privacyStatementUrl):h(2300,null,"https://aka.ms/vscode-telemetry"),t=Dr?"":h(2305,null),n=h(2298,null),i=h(2303,null),s=h(2314,null),a=h(2312,null),l=`
|       | ${n} | ${i} | ${s} |
|:------|:-------------:|:---------------:|:----------:|
| all   |       \u2713       |        \u2713        |     \u2713      |
| error |       \u2713       |        \u2713        |     -      |
| crash |       \u2713       |        -        |     -      |
| off   |       -       |        -        |     -      |
`,c=h(2308,null);return`
${o}
${r} ${e} ${t}

&nbsp;

${a}
${l}

&nbsp;

${c}
`}var po,KL,jE=w(()=>{K();yn();Y();Sd();dr();Ce();st();Gi();Pd();Qt();jn();ir();cs();po=class{constructor(r,e,t){this._configurationService=e;this._productService=t;this._experimentProperties={};this._pendingEvents=[];this._isExperimentPropertySet=!1;this._disposables=new te;this._cleanupPatterns=[];this._appenders=r.appenders,this._commonProperties=r.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=r.piiPaths||[],this._telemetryLevel=3,this._sendErrorTelemetry=!!r.sendErrorTelemetry,this._meteredConnectionService=r.meteredConnectionService,this._cleanupPatterns=[/(vscode-)?file:\/\/.*?\/resources\/app\//gi];for(let n of this._piiPaths)this._cleanupPatterns.push(new RegExp(Po(n),"gi")),n.indexOf("\\")>=0&&this._cleanupPatterns.push(new RegExp(Po(n.replace(/\\/g,"/")),"gi"));this._updateTelemetryLevel(),this._disposables.add(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration(hl)||n.affectsConfiguration(du)||n.affectsConfiguration(fm))&&this._updateTelemetryLevel()})),r.waitForExperimentProperties?this._flushTimeout=setTimeout(()=>this._flushPendingEvents(),po.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(r,e){this._experimentProperties[r]=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 r of this._pendingEvents)this._doLog(r.eventName,r.eventLevel,r.data);this._pendingEvents=[]}}_updateTelemetryLevel(){let r=Yl(this._configurationService),e=this._productService.enabledTelemetryLevels;if(e){this._sendErrorTelemetry=this.sendErrorTelemetry?e.error:!1;let t=e.usage?3:e.error?2:0;r=Math.min(r,t)}this._telemetryLevel=r}get sendErrorTelemetry(){return this._sendErrorTelemetry}get telemetryLevel(){return this._telemetryLevel}dispose(){this._flushPendingEvents(),this._disposables.dispose()}_log(r,e,t){if(!(this._telemetryLevel<e)&&!this._meteredConnectionService?.isConnectionMetered){if(!this._isExperimentPropertySet){this._pendingEvents.length<po.MAX_BUFFER_SIZE&&this._pendingEvents.push({eventName:r,eventLevel:e,data:t});return}this._doLog(r,e,t)}}_doLog(r,e,t){t=km(t,this._experimentProperties),t=KE(t,this._cleanupPatterns),t=km(t,this._commonProperties),this._appenders.forEach(n=>n.log(r,t??{}))}publicLog(r,e){this._log(r,3,e)}publicLog2(r,e){this.publicLog(r,e)}publicLogError(r,e){this._sendErrorTelemetry&&this._log(r,2,e)}publicLogError2(r,e){this.publicLogError(r,e)}};po=T([g(1,ge),g(2,_e)],po);KL=Tt.as(tr.Configuration);KL.registerConfiguration({id:oP,order:1,type:"object",title:h(2316,null),properties:{[hl]:{type:"string",enum:["all","error","crash","off"],enumDescriptions:[h(2307,null),h(2309,null),h(2306,null),h(2310,null)],markdownDescription:HL(),default:"all",restricted:!0,scope:1,tags:["usesOnlineServices","telemetry"],policy:{name:"TelemetryLevel",category:"Telemetry",minimumVersion:"1.99",localization:{description:{key:"telemetry.telemetryLevel.policyDescription",value:h(2311,null)},enumDescriptions:[{key:"telemetry.telemetryLevel.default",value:h(2307,null)},{key:"telemetry.telemetryLevel.error",value:h(2309,null)},{key:"telemetry.telemetryLevel.crash",value:h(2306,null)},{key:"telemetry.telemetryLevel.off",value:h(2310,null)}]}}},"telemetry.feedback.enabled":{type:"boolean",default:!0,description:h(2304,null),policy:{name:"EnableFeedback",category:"Telemetry",minimumVersion:"1.99",localization:{description:{key:"telemetry.feedback.enabled",value:h(2304,null)}}}},[du]:{type:"boolean",markdownDescription:Er.privacyStatementUrl?h(2302,null,Er.nameLong,Er.privacyStatementUrl):h(2301,null,Er.nameLong),default:!0,restricted:!0,markdownDeprecationMessage:h(2297,null,`\`#${hl}#\``),scope:1,tags:["usesOnlineServices","telemetry"]}}})});var Lh,JE=w(()=>{Q();K();lo();Lh=class{constructor(r){this.service=r}listen(r,e){if(e==="onStateChange")return this.service.onStateChange;throw new Error(`Event not found: ${e}`)}call(r,e,t){switch(e){case"checkForUpdates":return this.service.checkForUpdates(t);case"downloadUpdate":return this.service.downloadUpdate(t);case"applyUpdate":return this.service.applyUpdate();case"quitAndInstall":return this.service.quitAndInstall();case"_getInitialState":return Promise.resolve(this.service.state);case"isLatestVersion":return this.service.isLatestVersion();case"_applySpecificUpdate":return this.service._applySpecificUpdate(t);case"_devApplyUpdateFromUrl":return this.service._devApplyUpdateFromUrl(t);case"setInternalOrg":return this.service.setInternalOrg(t)}throw new Error(`Call not found: ${e}`)}}});import*as XE from"os";function ec(o,r,e,t,n){let i=new URL(`${o}/api/update/${r}/${e}/${t}`);return n?.background&&i.searchParams.set("bg","true"),i.searchParams.set("u",n?.internalOrg??"none"),n?.windsurfVersion&&i.searchParams.set("v",n.windsurfVersion),n?.applicationName&&i.searchParams.set("app",n.applicationName),i.toString()}function ju(o){if(V){let r=XE.release();return{"User-Agent":`Code/${o} Darwin/${r}`}}if(M){let r=gx().match(/^(\d+\.\d+)/);if(r)return{"User-Agent":`Code/${o} Electron/${process.versions.electron} Windows NT ${r[1]}`}}}var Li,Mh=w(()=>{he();St();Q();Y();el();as();st();Ot();xt();re();Qt();ns();lo();Li=class{constructor(r,e,t,n,i,s,a,l){this.lifecycleMainService=r;this.configurationService=e;this.environmentMainService=t;this.requestService=n;this.logService=i;this.productService=s;this.meteredConnectionService=a;this.supportsUpdateOverwrite=l;this._state=oe.Uninitialized;this._overwrite=!1;this._hasCheckedForOverwriteOnQuit=!1;this.overwriteUpdatesCheckInterval=new of;this._internalOrg=void 0;this._onStateChange=new x;this.onStateChange=this._onStateChange.event;r.when(3).finally(()=>this.initialize().catch(c=>this.logService.error("update#initialize - failed",c)))}get state(){return this._state}setState(r){this.logService.info("update#setState",r.type),this._state=r,this._onStateChange.fire(r),this.supportsUpdateOverwrite&&(r.type==="ready"?this.overwriteUpdatesCheckInterval.cancelAndSet(()=>this.checkForOverwriteUpdates(),300*1e3):this.overwriteUpdatesCheckInterval.cancel())}getEffectiveUpdateUrl(){if(this.productService.windsurf_multi_tenant_mode){let r=this.configurationService.getValue("windsurf.portalUrl")||this.configurationService.getValue("windsurf.serviceUrl");if(r)return r.replace(/\/$/,"")}return this.productService.updateUrl}async initialize(){if(!this.environmentMainService.isBuilt){this.setState(oe.Disabled(0));return}if(this.environmentMainService.disableUpdates){this.setState(oe.Disabled(1)),this.logService.info("update#ctor - updates are disabled by the environment");return}if(!this.getEffectiveUpdateUrl()||!this.productService.commit){this.setState(oe.Disabled(3)),this.logService.info("update#ctor - updates are disabled as there is no update URL");return}let r=this.configurationService.getValue("update.mode"),e=this.getProductQuality(r);if(!e){this.setState(oe.Disabled(2)),this.logService.info("update#ctor - updates are disabled by user preference");return}if(!this.buildUpdateFeedUrl(e,this.productService.commit)){this.setState(oe.Disabled(4)),this.logService.info("update#ctor - updates are disabled as the update URL is badly formed");return}if(this.quality=e,this.setState(oe.Idle(this.getUpdateType())),await this.postInitialize(),r==="manual"){this.logService.info("update#ctor - manual checks only; automatic updates are disabled by user preference");return}r==="start"?(this.logService.info("update#ctor - startup checks only; automatic updates are disabled by user preference"),setTimeout(()=>this.checkForUpdates(!1),30*1e3)):this.scheduleCheckForUpdates(30*1e3).then(void 0,t=>this.logService.error(t))}getProductQuality(r){return r==="none"?void 0:this.productService.quality}scheduleCheckForUpdates(r=3600*1e3){return lt(r).then(()=>this.checkForUpdates(!1)).then(()=>this.scheduleCheckForUpdates(3600*1e3))}canCheckForUpdates(){return this.state.type==="idle"}async checkForUpdates(r){this.logService.trace("update#checkForUpdates, state = ",this.state.type),this.canCheckForUpdates()&&await this.doCheckForUpdates(r)}async downloadUpdate(r){if(this.logService.trace("update#downloadUpdate, state = ",this.state.type),this.state.type==="available for download"){if(!r&&this.meteredConnectionService.isConnectionMetered){this.logService.info("update#downloadUpdate - skipping download because connection is metered");return}await this.doDownloadUpdate(this.state)}}async doDownloadUpdate(r){}async applyUpdate(){this.logService.trace("update#applyUpdate, state = ",this.state.type),this.state.type==="downloaded"&&await this.doApplyUpdate()}async doApplyUpdate(){}async quitAndInstall(){if(this.logService.trace("update#quitAndInstall, state = ",this.state.type),this.state.type!=="ready")return;if(this.supportsUpdateOverwrite&&!this._hasCheckedForOverwriteOnQuit&&(this._hasCheckedForOverwriteOnQuit=!0,await this.checkForOverwriteUpdates(!0))){this.logService.info("update#quitAndInstall(): overwrite update detected, postponing quitAndInstall");return}this.logService.trace("update#quitAndInstall(): before lifecycle quit()");let r=await this.lifecycleMainService.quit(!0);this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${r}`),!r&&(this.logService.trace("update#quitAndInstall(): running raw#quitAndInstall()"),this.doQuitAndInstall())}async checkForOverwriteUpdates(r=!1){if(this._state.type!=="ready")return!1;let e=this._state.update.version,t;try{let n=new qe,i=lt(2e3).then(()=>{n.cancel()});t=await Promise.race([this.isLatestVersion(e,n.token),i]),n.dispose()}catch(n){return this.logService.warn("update#checkForOverwriteUpdates(): failed to check for updates, proceeding with restart"),this.logService.warn(n),!1}if(t===!1&&this._state.type==="ready"){this.logService.info("update#readyStateCheck: newer update available, restarting update machinery");try{await this.cancelPendingUpdate()}catch(n){return this.logService.error("update#checkForOverwriteUpdates(): failed to cancel pending update, aborting overwrite"),this.logService.error(n),!1}return this._overwrite=!0,this.setState(oe.Overwriting(this._state.update,r)),this.doCheckForUpdates(r,e),!0}return!1}async isLatestVersion(r,e=be.None){if(!this.quality||this.configurationService.getValue("update.mode")==="none")return;let n=this.buildUpdateFeedUrl(this.quality,r??this.productService.commit);if(!n)return;let i=ju(this.productService.version);this.logService.trace("update#isLatestVersion() - checking update server",{url:n,headers:i});try{let a=(await this.requestService.request({url:n,headers:i},e)).res.statusCode;return this.logService.trace("update#isLatestVersion() - response",{statusCode:a}),a===204}catch(s){this.logService.error("update#isLatestVersion(): failed to check for updates"),this.logService.error(s);return}}async _applySpecificUpdate(r){}async _devApplyUpdateFromUrl(r){this.logService.info("update#_devApplyUpdateFromUrl",r)}async setInternalOrg(r){this._internalOrg!==r&&(this.logService.info("update#setInternalOrg",r),this._internalOrg=r)}getInternalOrg(){return this._internalOrg}getUpdateType(){return 1}doQuitAndInstall(){}async postInitialize(){}async cancelPendingUpdate(){}};Li=T([g(0,me),g(1,ge),g(2,Te),g(3,Ln),g(4,O),g(5,_e),g(6,Qr)],Li)});import*as Mn from"electron";var ni,YE=w(()=>{St();Wo();Q();yi();K();st();Ot();xt();re();Qt();ns();ir();lo();as();Mh();ni=class extends Li{constructor(e,t,n,i,s,a,l,c){super(e,t,i,s,a,l,c,!0);this.telemetryService=n;this.disposables=new te;e.setRelaunchHandler(this)}get onRawError(){return E.fromNodeEventEmitter(Mn.autoUpdater,"error",(e,t)=>t)}get onRawCheckingForUpdate(){return E.fromNodeEventEmitter(Mn.autoUpdater,"checking-for-update")}get onRawUpdateNotAvailable(){return E.fromNodeEventEmitter(Mn.autoUpdater,"update-not-available")}get onRawUpdateAvailable(){return E.fromNodeEventEmitter(Mn.autoUpdater,"update-available")}get onRawUpdateDownloaded(){return E.fromNodeEventEmitter(Mn.autoUpdater,"update-downloaded",(e,t,n,i)=>({version:t,productVersion:n,timestamp:i instanceof Date?i.getTime()||void 0:i}))}handleRelaunch(e){return e?.addArgs||e?.removeArgs||this.state.type!=="ready"?!1:(this.logService.trace("update#handleRelaunch(): running raw#quitAndInstall()"),this.doQuitAndInstall(),!0)}async initialize(){if(process.isEmbeddedApp){this.setState(oe.Disabled(6)),this.logService.info("update#ctor - updates are disabled from embedded app");return}await super.initialize(),this.onRawError(this.onError,this,this.disposables),this.onRawCheckingForUpdate(this.onCheckingForUpdate,this,this.disposables),this.onRawUpdateAvailable(this.onUpdateAvailable,this,this.disposables),this.onRawUpdateDownloaded(this.onUpdateDownloaded,this,this.disposables),this.onRawUpdateNotAvailable(this.onUpdateNotAvailable,this,this.disposables)}onCheckingForUpdate(){this.logService.trace("update#onCheckingForUpdate - Electron autoUpdater is checking for updates")}onError(e){this.telemetryService.publicLog2("update:error",{messageHash:String(rr(String(e)))}),this.logService.error("UpdateService error:",e),this.pendingServerMetadataPromise=void 0;let t=this.state.type==="checking for updates"&&this.state.explicit?e:void 0;this.setState(oe.Idle(1,t)),this.resolveUpdateCheckComplete()}resolveUpdateCheckComplete(){this.updateCheckCompleteResolver&&(this.updateCheckCompleteResolver(),this.updateCheckCompleteResolver=void 0)}createUpdateFeedUrl(e,t,n){let i=this.productService.darwinUniversalAssetId??(process.arch==="x64"?"darwin":"darwin-arm64");return ec(this.getEffectiveUpdateUrl(),i,e,t,{...n,windsurfVersion:this.productService.windsurfVersion,applicationName:this.productService.applicationName})}buildUpdateFeedUrl(e,t,n){let i=this.productService.darwinUniversalAssetId??(process.arch==="x64"?"darwin":"darwin-arm64"),s=this.createUpdateFeedUrl(e,t,n),a=ju(this.productService.version);try{this.logService.trace("update#buildUpdateFeedUrl - setting feed URL for Electron autoUpdater",{url:s,assetID:i,quality:e,commit:t,headers:a}),Mn.autoUpdater.setFeedURL({url:s,headers:a})}catch(l){this.logService.error("Failed to set update feed URL",l);return}return s}async checkForUpdates(e){this.logService.trace("update#checkForUpdates, state = ",this.state.type),this.state.type==="idle"&&await this.doCheckForUpdates(e)}async doCheckForUpdates(e,t){if(!this.quality)return;this.setState(oe.CheckingForUpdates(e));let n=this.getInternalOrg(),i=!e&&!n,s=this.buildUpdateFeedUrl(this.quality,t??this.productService.commit,{background:i,internalOrg:n});if(s){if(!e&&this.meteredConnectionService.isConnectionMetered){this.logService.info("update#doCheckForUpdates - checking for update without auto-download because connection is metered"),this.checkForUpdateNoDownload(s);return}this.logService.trace("update#doCheckForUpdates - using Electron autoUpdater",{url:s,explicit:e,background:i}),this.pendingServerMetadataPromise=this.fetchServerMetadata(s),Mn.autoUpdater.checkForUpdates()}}async fetchServerMetadata(e){let t=new qe,n=setTimeout(()=>t.cancel(),5e3);try{let i=ju(this.productService.version),s=await this.requestService.request({url:e,headers:i},t.token);return await na(s)??void 0}catch(i){this.logService.trace("update#fetchServerMetadata - failed to fetch metadata",i);return}finally{clearTimeout(n),t.dispose()}}async checkForUpdateNoDownload(e){let t=ju(this.productService.version);this.logService.trace("update#checkForUpdateNoDownload - checking update server",{url:e,headers:t});try{let n=await this.requestService.request({url:e,headers:t},be.None),i=n.res.statusCode;this.logService.trace("update#checkForUpdateNoDownload - response",{statusCode:i});let s=await na(n);!s||!s.url||!s.version||!s.productVersion?(this.logService.trace("update#checkForUpdateNoDownload - no update available"),this.setState(oe.Idle(1))):(this.logService.trace("update#checkForUpdateNoDownload - update available",{version:s.version,productVersion:s.productVersion}),this.setState(oe.AvailableForDownload(s)))}catch(n){this.logService.error("update#checkForUpdateNoDownload - failed to check for update",n),this.setState(oe.Idle(1))}}onUpdateAvailable(){this.logService.trace("update#onUpdateAvailable - Electron autoUpdater reported update available"),!(this.state.type!=="checking for updates"&&this.state.type!=="overwriting")&&this.setState(oe.Downloading(this.state.type==="overwriting"?this.state.update:void 0,this.state.explicit,this._overwrite))}async onUpdateDownloaded(e){if(this.state.type!=="downloading")return;let t=this.state.explicit;if(this.pendingServerMetadataPromise){let n=await this.pendingServerMetadataPromise;if(this.pendingServerMetadataPromise=void 0,this.state.type!=="downloading")return;n&&n.version===e.version&&(n.restartUpdateMessage&&(e={...e,restartUpdateMessage:n.restartUpdateMessage}),n.restartUpdateConfirmationMessage&&(e={...e,restartUpdateConfirmationMessage:n.restartUpdateConfirmationMessage}))}this.setState(oe.Downloaded(e,t,this._overwrite)),this.logService.info(`Update downloaded: ${JSON.stringify(e)}`),this.telemetryService.publicLog2("update:downloaded",{newVersion:e.version}),this.setState(oe.Ready(e,t,this._overwrite)),this.resolveUpdateCheckComplete()}onUpdateNotAvailable(){this.logService.trace("update#onUpdateNotAvailable - Electron autoUpdater reported no update available"),this.pendingServerMetadataPromise=void 0,this.state.type==="checking for updates"&&(this.setState(oe.Idle(1)),this.resolveUpdateCheckComplete())}async doDownloadUpdate(e){this.buildUpdateFeedUrl(this.quality,e.update.version,{internalOrg:this.getInternalOrg()}),this.pendingServerMetadataPromise=Promise.resolve(e.update),this.setState(oe.CheckingForUpdates(!0)),Mn.autoUpdater.checkForUpdates()}doQuitAndInstall(){this.logService.trace("update#quitAndInstall(): running raw#quitAndInstall()"),Mn.autoUpdater.quitAndInstall()}async _devApplyUpdateFromUrl(e){this.logService.info("update#_devApplyUpdateFromUrl (darwin)",e);let n=(await import("http")).createServer((s,a)=>{a.writeHead(200,{"Content-Type":"application/json"}),a.end(JSON.stringify({url:e,name:"dev-update",notes:"Dev update from custom URL",pub_date:new Date().toISOString()})),n.close()});await new Promise(s=>n.listen(0,"127.0.0.1",s));let i=n.address().port;try{Mn.autoUpdater.setFeedURL({url:`http://127.0.0.1:${i}`})}catch(s){throw this.logService.error("update#_devApplyUpdateFromUrl: failed to set feed URL",s),n.close(),s}this.setState(oe.CheckingForUpdates(!0)),Mn.autoUpdater.checkForUpdates()}dispose(){this.disposables.dispose()}};T([de],ni.prototype,"onRawError",1),T([de],ni.prototype,"onRawCheckingForUpdate",1),T([de],ni.prototype,"onRawUpdateNotAvailable",1),T([de],ni.prototype,"onRawUpdateAvailable",1),T([de],ni.prototype,"onRawUpdateDownloaded",1),ni=T([g(0,me),g(1,ge),g(2,ot),g(3,Te),g(4,Ln),g(5,O),g(6,_e),g(7,Qr)],ni)});import{spawn as ZE}from"child_process";import{mkdir as eT}from"fs/promises";import{tmpdir as $L}from"os";var tc,tT=w(()=>{St();Se();se();jt();st();Ot();je();xt();re();as();$u();Qt();ns();lo();Mh();Ce();tc=class extends Li{constructor(e,t,n,i,s,a,l,c,d){super(e,t,n,i,s,l,c,!1);this.nativeHostMainService=a;this.fileService=d}buildUpdateFeedUrl(e,t,n){return ec(this.getEffectiveUpdateUrl(),`linux-${process.arch}`,e,t,{...n,windsurfVersion:this.productService.windsurfVersion,applicationName:this.productService.applicationName})}async doCheckForUpdates(e,t){if(!this.quality)return;let n=this.getInternalOrg(),i=!e&&!n,s=this.buildUpdateFeedUrl(this.quality,this.productService.commit,{background:i,internalOrg:n});this.setState(oe.CheckingForUpdates(e));try{let a=await this.requestService.request({url:s},be.None).then(na);!a||!a.url||!a.version||!a.productVersion?this.setState(oe.Idle(1)):this.setState(oe.AvailableForDownload(a))}catch(a){this.logService.error(a);let l=e?a instanceof Error?a.message:String(a):void 0;this.setState(oe.Idle(1,l))}}async doDownloadUpdate(e){if(e.update.url){let t=[h(2704,null),h(2707,null)],n=await this.nativeHostMainService.getActiveWindowId(void 0),{response:i}=await this.nativeHostMainService.showMessageBox(n,{type:"info",message:h(2706,null),detail:h(2705,null,e.update.windsurfVersion??e.update.productVersion),buttons:t});i===1&&this.nativeHostMainService.openExternal(void 0,"https://codeium.com/windsurf/update_linux")}this.setState(oe.Idle(1))}async _devApplyUpdateFromUrl(e){if(this.logService.info("update#_devApplyUpdateFromUrl (linux)",e),this.state.type!=="idle"&&this.state.type!=="disabled"){this.logService.warn("update#_devApplyUpdateFromUrl: not in idle or disabled state, current state:",this.state.type);return}let t={version:"dev-update",productVersion:"dev"},n=U($L(),`windsurf-dev-update-${Date.now()}`);await eT(n,{recursive:!0});let i="windsurf-dev-update.tar.gz",s=U(n,`${i}.tmp`),a=U(n,i),l=U(n,"extracted");try{this.setState(oe.CheckingForUpdates(!0)),this.logService.info("update#_devApplyUpdateFromUrl: downloading",e),this.setState(oe.Downloading(t,!0,!1));let c=await this.requestService.request({url:e},be.None);await this.fileService.writeFile(b.file(s),c.stream),await q.rename(s,a,!1),this.logService.info("update#_devApplyUpdateFromUrl: download complete",a),this.setState(oe.Downloaded(t,!0,!1)),this.logService.info("update#_devApplyUpdateFromUrl: extracting to",l),await eT(l,{recursive:!0}),await new Promise((d,u)=>{let f=ZE("tar",["xzf",a,"-C",l],{stdio:"ignore"});f.on("exit",m=>{m===0?d():u(new Error(`tar extraction failed with exit code ${m}`))}),f.on("error",u)}),this.logService.info("update#_devApplyUpdateFromUrl: extraction complete"),this._devUpdateStagingPath=l,this.setState(oe.Ready(t,!0,!1))}catch(c){this.logService.error("update#_devApplyUpdateFromUrl: failed",c),this.setState(oe.Idle(1,c instanceof Error?c.message:String(c)))}}doQuitAndInstall(){if(!this._devUpdateStagingPath)return;let e=$e(process.execPath);this.logService.info("update#doQuitAndInstall (linux): replacing",e,"with",this._devUpdateStagingPath),ZE("bash",["-c",`
			sleep 2
			SOURCE_DIR=$(find "${this._devUpdateStagingPath}" -maxdepth 1 -mindepth 1 -type d | head -1)
			if [ -z "$SOURCE_DIR" ]; then
				SOURCE_DIR="${this._devUpdateStagingPath}"
			fi
			cp -a "$SOURCE_DIR"/* "${e}/"
			"${process.execPath}" &
		`],{detached:!0,stdio:"ignore"})}};tc=T([g(0,me),g(1,ge),g(2,Te),g(3,Ln),g(4,O),g(5,Di),g(6,_e),g(7,Qr),g(8,ke)],tc)});import{spawn as qL}from"child_process";import{realpath as zL,watch as GL}from"fs";var Ju,rc,rT=w(()=>{he();Q();Se();Ot();xt();re();lo();as();Ju=class{constructor(r,e,t,n){this.lifecycleMainService=r;this.logService=t;this.meteredConnectionService=n;this._state=oe.Uninitialized;this._onStateChange=new x;this.onStateChange=this._onStateChange.event;if(e.disableUpdates){this.logService.info("update#ctor - updates are disabled");return}this.setState(oe.Idle(this.getUpdateType())),this.scheduleCheckForUpdates(30*1e3).then(void 0,i=>this.logService.error(i))}get state(){return this._state}setState(r){this.logService.info("update#setState",r.type),this._state=r,this._onStateChange.fire(r)}scheduleCheckForUpdates(r=3600*1e3){return lt(r).then(()=>this.checkForUpdates(!1)).then(()=>this.scheduleCheckForUpdates(3600*1e3))}async checkForUpdates(r){this.logService.trace("update#checkForUpdates, state = ",this.state.type),this.state.type==="idle"&&await this.doCheckForUpdates(r)}async downloadUpdate(r){if(this.logService.trace("update#downloadUpdate, state = ",this.state.type),this.state.type==="available for download"){if(!r&&this.meteredConnectionService.isConnectionMetered){this.logService.info("update#downloadUpdate - skipping download because connection is metered");return}await this.doDownloadUpdate(this.state)}}doDownloadUpdate(r){return Promise.resolve(void 0)}async applyUpdate(){this.logService.trace("update#applyUpdate, state = ",this.state.type),this.state.type==="downloaded"&&await this.doApplyUpdate()}doApplyUpdate(){return Promise.resolve(void 0)}async quitAndInstall(){if(this.logService.trace("update#quitAndInstall, state = ",this.state.type),this.state.type!=="ready")return;this.logService.trace("update#quitAndInstall(): before lifecycle quit()");let r=await this.lifecycleMainService.quit(!0);this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${r}`),!r&&(this.logService.trace("update#quitAndInstall(): running raw#quitAndInstall()"),this.doQuitAndInstall())}getUpdateType(){return 2}doQuitAndInstall(){}async setInternalOrg(r){}async _applySpecificUpdate(r){}async _devApplyUpdateFromUrl(r){}};Ju=T([g(0,me),g(1,Te),g(2,O),g(3,Qr)],Ju);rc=class extends Ju{constructor(e,t,n,i,s,a){super(n,i,s,a);this.snap=e;this.snapRevision=t;let l=GL($e(this.snap)),c=E.fromNodeEventEmitter(l,"change",(m,y)=>y),d=E.filter(c,m=>m==="current"),f=E.debounce(d,(m,y)=>y,2e3)(()=>this.checkForUpdates(!1));E.once(n.onWillShutdown)(()=>{f.dispose(),l.close()})}async doCheckForUpdates(){this.setState(oe.CheckingForUpdates(!1));try{await this.isUpdateAvailable()?this.setState(oe.Ready({version:"something"},!1,!1)):this.setState(oe.Idle(2))}catch(e){this.logService.error(e),this.setState(oe.Idle(2,e.message||e))}}doQuitAndInstall(){this.logService.trace("update#quitAndInstall(): running raw#quitAndInstall()"),qL("sleep 3 && "+ye(process.argv[0]),{shell:!0,detached:!0,stdio:"ignore"})}async isUpdateAvailable(){let e=await new Promise((n,i)=>zL(`${$e(this.snap)}/current`,(s,a)=>s?i(s):n(a))),t=ye(e);return this.snapRevision!==t}isLatestVersion(){return this.isUpdateAvailable().then(void 0,e=>{this.logService.error("update#checkForSnapUpdate(): Could not get realpath of application.")})}};rc=T([g(2,me),g(3,Te),g(4,O),g(5,Qr)],rc)});import*as nT from"crypto";import*as iT from"fs";async function oT(o,r){if(await new Promise((n,i)=>{let s=iT.createReadStream(o),a=nT.createHash("sha256");s.pipe(a);let l=Hi((c,d)=>{s.removeAllListeners(),a.removeAllListeners(),c?i(c):n(d)});s.once("error",l),s.once("end",l),a.once("error",l),a.once("data",c=>l(void 0,c.toString("hex")))})!==r)throw new Error("Hash mismatch")}var sT=w(()=>{Pa()});import{spawn as gI}from"child_process";import{app as aT}from"electron";import{existsSync as jL,unlinkSync as JL}from"fs";import{mkdir as QL,readFile as vI,unlink as XL}from"fs/promises";import{release as YL,tmpdir as ZL}from"os";function fo(){return typeof yI>"u"&&(yI=jL(U($e(process.execPath),"unins000.exe"))?0:1),yI}var yI,aa,lT=w(()=>{he();St();Wo();yi();Se();Se();se();sT();jt();Ul();el();st();Ot();je();xt();re();as();$u();Qt();ns();ir();lo();Mh();aa=class extends Li{constructor(e,t,n,i,s,a,l,c,d,u){super(e,t,i,s,a,d,u,!0);this.telemetryService=n;this.fileService=l;this.nativeHostMainService=c;e.setRelaunchHandler(this)}get cachePath(){let e=U(ZL(),`windsurf-${this.productService.quality}-${this.productService.target}-${process.arch}`);return QL(e,{recursive:!0}).then(()=>e)}handleRelaunch(e){return e?.addArgs||e?.removeArgs||this.state.type!=="ready"||!this.availableUpdate?!1:(this.logService.trace("update#handleRelaunch(): running raw#quitAndInstall()"),this.doQuitAndInstall(),!0)}async initialize(){if(process.isEmbeddedApp){this.setState(oe.Disabled(6)),this.logService.info("update#ctor - updates are disabled from embedded app");return}if(this.productService.win32VersionedUpdate){let n=await this.cachePath;aT.setPath("appUpdate",n),await this.unlink(U(n,"session-ending.flag"))}let e=await hx(),t=YL();if(this.telemetryService.publicLog2("windowsUpdateInit",{osRelease:e,osNodeRelease:t}),this.productService.target==="user"&&await this.nativeHostMainService.isAdmin(void 0)){this.setState(oe.Disabled(5)),this.logService.info("update#ctor - updates are disabled due to running as Admin in user setup");return}await super.initialize()}async postInitialize(){if(!this.productService.win32VersionedUpdate)return;let e=aT.getPath("exe"),t=$e(e),n=U(t,"updating_version");if(await q.exists(n))try{let i=(await vI(n,"utf8")).trim();this.logService.info(`update#doCheckForUpdates - application was updating to version ${i}`);let s=await this.getUpdatePackagePath(i);await q.exists(s)&&(await this._applySpecificUpdate(s),this.logService.info(`update#doCheckForUpdates - successfully applied update to version ${i}`))}catch(i){this.logService.error(`update#doCheckForUpdates - could not read ${n}`,i)}else if(this.configurationService.getValue("update.enableWindowsBackgroundUpdates")&&this.productService.target==="user"&&this.productService.commit){let s=U(t,"tools","inno_updater.exe");await new Promise(a=>{gI(s,["--gc",e],{stdio:["ignore","ignore","ignore"],windowsHide:!0,timeout:12e4}).once("exit",()=>a())})}}buildUpdateFeedUrl(e,t,n){let i=`win32-${process.arch}`;return fo()===1?i+="-archive":this.productService.target==="user"&&(i+="-user"),ec(this.getEffectiveUpdateUrl(),i,e,t,{...n,windsurfVersion:this.productService.windsurfVersion,applicationName:this.productService.applicationName})}async doCheckForUpdates(e,t){if(!this.quality)return;let n=this.getInternalOrg(),i=!e&&!n,s=this.buildUpdateFeedUrl(this.quality,t??this.productService.commit,{background:i,internalOrg:n});try{let a=await this.requestService.request({url:s},be.None).then(na),l=fo();if(!a||!a.url||!a.version||!a.productVersion){this.setState(oe.Idle(l));return}if(l===1){this.setState(oe.AvailableForDownload(a));return}this.setState(oe.Downloading(a,e,this._overwrite)),await this.cleanup(a.version);let c=await this.getUpdatePackagePath(a.version),d=await q.exists(c),u;if(d)u=c;else{let m=`${c}.tmp`,y=await this.requestService.request({url:a.url},be.None);await this.fileService.writeFile(b.file(m),y.stream),a.sha256hash&&await oT(m,a.sha256hash),await q.rename(m,c,!1),u=c}this.availableUpdate={packagePath:u},this.setState(oe.Downloaded(a,e,this._overwrite)),this.configurationService.getValue("update.enableWindowsBackgroundUpdates")?this.productService.target==="user"&&this.doApplyUpdate():this.setState(oe.Ready(a,e,this._overwrite))}catch(a){this.telemetryService.publicLog2("update:error",{messageHash:String(rr(String(a)))}),this.logService.error(a);let l=e?a instanceof Error?a.message:String(a):void 0;this.setState(oe.Idle(fo(),l))}}async doDownloadUpdate(e){e.update.url&&this.nativeHostMainService.openExternal(void 0,e.update.url),this.setState(oe.Idle(fo()))}async getUpdatePackagePath(e){let t=await this.cachePath;return U(t,`WindsurfSetup-${this.productService.quality}-${e}.exe`)}async cleanup(e=null){let t=e?a=>!new RegExp(`${this.productService.quality}-${e}\\.exe$`).test(a):()=>!0,n=await this.cachePath,s=(await q.readdir(n)).filter(t).map(a=>this.unlink(U(n,a)));await Promise.all(s)}async doApplyUpdate(){if(this.state.type!=="downloaded"||!this.availableUpdate)return Promise.resolve(void 0);let e=this.state.update,t=this.state.explicit;this.setState(oe.Updating(e));let n=await this.cachePath,i=U(n,"session-ending.flag"),s=U(n,"cancel.flag");await this.unlink(s);let a=U(n,"update-progress");await this.unlink(a),this.availableUpdate.updateFilePath=U(n,`WindsurfSetup-${this.productService.quality}-${e.version}.flag`),await q.writeFile(this.availableUpdate.updateFilePath,"flag");let l=gI(this.availableUpdate.packagePath,["/verysilent","/log",`/update="${this.availableUpdate.updateFilePath}"`,`/progress="${a}"`,`/sessionend="${i}"`,`/cancel="${s}"`,"/nocloseapplications","/mergetasks=runcode,!desktopicon,!quicklaunchicon"],{detached:!0,stdio:["ignore","ignore","ignore"],windowsVerbatimArguments:!0,env:{...process.env,__COMPAT_LAYER:"RunAsInvoker"}});this.availableUpdate.updateProcess=l,l.once("exit",()=>{this.availableUpdate=void 0,this.setState(oe.Idle(fo()))});let c=`${this.productService.win32MutexName}-ready`,d=await import("@vscode/windows-mutex");this.updateCancellationTokenSource?.dispose(!0);let u=this.updateCancellationTokenSource=new qe,f=u.token,m=async()=>{for(;this.state.type==="updating"&&!f.isCancellationRequested;){if(d.isActive(c)){this.setState(oe.Ready(e,t,this._overwrite));return}try{let v=await vI(a,"utf8");if(!f.isCancellationRequested){let[S,I]=v.split(","),k=parseInt(S,10),R=parseInt(I,10);!isNaN(k)&&!isNaN(R)&&this.state.type==="updating"&&(this.state.currentProgress!==k||this.state.maxProgress!==R)&&this.setState(oe.Updating(e,k,R))}}catch{}await lt(500)}},y=new sf(()=>{this.logService.warn("update#doApplyUpdate: polling timed out waiting for update to be ready"),this.setState(oe.Idle(fo(),"Update did not complete within expected time"))},3600*1e3);y.schedule(),m().finally(()=>{y.dispose(),this.updateCancellationTokenSource===u&&(this.updateCancellationTokenSource=void 0),u.dispose()})}async cancelPendingUpdate(){if(!this.availableUpdate)return;this.updateCancellationTokenSource?.dispose(!0),this.updateCancellationTokenSource=void 0,this.logService.trace("update#cancelPendingUpdate: cancelling pending update");let{updateProcess:e,updateFilePath:t,cancelFilePath:n}=this.availableUpdate;if(e&&e.exitCode===null){e.removeAllListeners();let i=new Promise(l=>e.once("exit",()=>l(!0)));if(n)try{await q.writeFile(n,"cancel")}catch(l){this.logService.warn("update#cancelPendingUpdate: failed to write cancel file",l)}let s=e.pid,a=await Promise.race([i,lt(30*1e3).then(()=>!1)]);s&&!a&&(this.logService.trace("update#cancelPendingUpdate: process did not exit gracefully, killing process tree"),await l0(s,!0))}await this.unlink(t),await this.unlink(n),this.availableUpdate=void 0}doQuitAndInstall(){if(!(this.state.type!=="ready"||!this.availableUpdate))if(this.logService.trace("update#quitAndInstall(): running raw#quitAndInstall()"),this.availableUpdate.updateFilePath)try{JL(this.availableUpdate.updateFilePath)}catch{}else gI(this.availableUpdate.packagePath,["/silent","/log","/mergetasks=runcode,!desktopicon,!quicklaunchicon"],{detached:!0,stdio:["ignore","ignore","ignore"],env:{...process.env,__COMPAT_LAYER:"RunAsInvoker"}})}async loadUpdateMetadata(){try{let e=await this.cachePath,t=U(e,"update-metadata.json");if(await q.exists(t)){let n=await vI(t,"utf8");return JSON.parse(n)}}catch(e){this.logService.error("update#loadUpdateMetadata: failed to load",e)}}getUpdateType(){return fo()}async _devApplyUpdateFromUrl(e){if(this.logService.info("update#_devApplyUpdateFromUrl (win32)",e),this.state.type!=="idle"&&this.state.type!=="disabled"){this.logService.warn("update#_devApplyUpdateFromUrl: not in idle or disabled state, current state:",this.state.type);return}let t=await this.cachePath,n=`WindsurfSetup-dev-${Date.now()}.exe`,i=U(t,`${n}.tmp`),s=U(t,n);try{this.logService.info("update#_devApplyUpdateFromUrl: downloading",e);let a=await this.requestService.request({url:e},be.None);await this.fileService.writeFile(b.file(i),a.stream),await q.rename(i,s,!1),this.logService.info("update#_devApplyUpdateFromUrl: download complete, applying",s);let l={version:"dev-update",productVersion:"dev"};this.setState(oe.Idle(fo())),this.availableUpdate={packagePath:s},this.setState(oe.Downloading(l,!0,!1)),this.setState(oe.Downloaded(l,!0,!1)),this.configurationService.getValue("update.enableWindowsBackgroundUpdates")&&this.productService.target==="user"?this.doApplyUpdate():this.setState(oe.Ready(l,!0,!1))}catch(a){this.logService.error("update#_devApplyUpdateFromUrl: failed",a),this.setState(oe.Idle(fo(),a instanceof Error?a.message:String(a)))}}async _applySpecificUpdate(e){if(this.state.type!=="idle")return;let t=this.configurationService.getValue("update.enableWindowsBackgroundUpdates"),n=await this.loadUpdateMetadata()??{version:"unknown",productVersion:"unknown"};this.setState(oe.Downloading(n,!0,!1)),this.availableUpdate={packagePath:e},this.setState(oe.Downloaded(n,!0,!1)),t&&this.productService.target==="user"?this.doApplyUpdate():this.setState(oe.Ready(n,!0,!1))}async unlink(e){if(e)try{await XL(e)}catch(t){let n=t;if(n&&n.code==="ENOENT")return;this.logService.warn(`update#unlink: failed to unlink ${ye(e)}`,t)}}};T([de],aa.prototype,"cachePath",1),aa=T([g(0,me),g(1,ge),g(2,ot),g(3,Te),g(4,Ln),g(5,O),g(6,ke),g(7,Di),g(8,_e),g(9,Qr)],aa)});var Oh,Fh,cT=w(()=>{se();Oh=class{constructor(r){this.channel=r}handleURL(r,e){return this.channel.call("handleURL",[r.toJSON(),e])}},Fh=class{constructor(r,e){this.next=r;this.logService=e}async routeCall(r,e,t,n){if(e!=="handleURL")throw new Error(`Call not found: ${e}`);if(Array.isArray(t)&&t.length>0){let i=b.revive(t[0]);if(this.logService.trace("URLHandlerRouter#routeCall() with URI argument",i.toString(!0)),i.query){let s=/\bwindowId=(\d+)/.exec(i.query);if(s){let a=s[1];this.logService.trace(`URLHandlerRouter#routeCall(): found windowId query parameter with value "${a}"`,i.toString(!0));let l=new RegExp(`window:${a}`),c=r.connections.find(d=>(this.logService.trace("URLHandlerRouter#routeCall(): testing connection",d.ctx),l.test(d.ctx)));if(c)return this.logService.trace("URLHandlerRouter#routeCall(): found a connection to route",i.toString(!0)),c;this.logService.trace("URLHandlerRouter#routeCall(): did not find a connection to route",i.toString(!0))}else this.logService.trace("URLHandlerRouter#routeCall(): did not find windowId query parameter",i.toString(!0))}}else this.logService.trace("URLHandlerRouter#routeCall() without URI argument");return this.next.routeCall(r,e,t,n)}routeEvent(r,e){throw new Error(`Event not found: ${e}`)}}});var wI,nc,dT=w(()=>{he();K();se();Qt();wI=class extends C{constructor(){super(...arguments);this.handlers=new Set}open(e,t){let n=[...this.handlers.values()];return f1(n.map(i=>()=>i.handleURL(e,t)),void 0,!1).then(i=>i||!1)}registerHandler(e){return this.handlers.add(e),j(()=>this.handlers.delete(e))}},nc=class extends wI{constructor(e){super();this.productService=e}create(e){let{authority:t,path:n,query:i,fragment:s}=e||{authority:void 0,path:void 0,query:void 0,fragment:void 0};return t&&n&&n.indexOf("/")!==0&&(n=`/${n}`),b.from({scheme:this.productService.urlProtocol,authority:t,path:n,query:i,fragment:s})}};nc=T([g(0,_e)],nc)});import{app as uT}from"electron";var Uh,pT=w(()=>{he();Q();K();Y();se();Uh=class extends C{constructor(e,t,n,i,s,a){super();this.urlService=t;this.logService=a;this.uris=[];this.retryCount=0;if(e&&(a.trace("ElectronURLListener initialUrisToHandle:",e.map(d=>d.originalUrl)),this.uris=e),M&&!i.isPortable){let d=i.isBuilt?[]:[`"${i.appRoot}"`];d.push("--open-url","--"),uT.setAsDefaultProtocolClient(s.urlProtocol,process.execPath,d)}let l=E.map(E.fromNodeEventEmitter(uT,"open-url",(d,u)=>({event:d,url:u})),({event:d,url:u})=>(d.preventDefault(),u));this._register(l(d=>{let u=this.uriFromRawUrl(d);u&&this.urlService.open(u,{originalUrl:d})})),n.getWindows().filter(d=>d.isReady).length>0?(a.trace("ElectronURLListener: window is ready to handle URLs"),this.flush()):(a.trace("ElectronURLListener: waiting for window to be ready to handle URLs..."),this._register(E.once(n.onDidSignalReadyWindow)(()=>this.flush())))}uriFromRawUrl(e){try{return b.parse(e)}catch{return}}async flush(){if(this.retryCount++>10){this.logService.trace("ElectronURLListener#flush(): giving up after 10 retries");return}this.logService.trace("ElectronURLListener#flush(): flushing URLs");let e=[];for(let t of this.uris)await this.urlService.open(t.uri,{originalUrl:t.originalUrl})?this.logService.trace("ElectronURLListener#flush(): URL was handled",t.originalUrl):(this.logService.trace("ElectronURLListener#flush(): URL was not yet handled",t.originalUrl),e.push(t));e.length!==0&&(this.uris=e,df(()=>this.flush(),500,this._store))}}});var II,fT=w(()=>{Z();II=W("webviewManagerService")});import{protocol as mT}from"electron";var us,hT=w(()=>{ze();se();je();us=class{constructor(r){this._fileService=r;let e=this.handleWebviewRequest.bind(this);mT.handle(N.vscodeWebview,e)}static{this.validWebviewFilePaths=new Map([["/index.html",{mime:"text/html"}],["/fake.html",{mime:"text/html"}],["/service-worker.js",{mime:"application/javascript"}]])}dispose(){mT.unhandle(N.vscodeWebview)}async handleWebviewRequest(r){try{let e=b.parse(r.url),t=us.validWebviewFilePaths.get(e.path);if(t){let n=`vs/workbench/contrib/webview/browser/pre${e.path}`,i=et.asFileUri(n),s=await this._fileService.readFile(i);return new Response(s.value.buffer.buffer,{headers:{"Content-Type":t.mime,...Ma.getHeadersFromQuery(r.url),"Cross-Origin-Resource-Policy":"cross-origin"}})}else return new Response(null,{status:403})}catch{}return new Response(null,{status:500})}};us=T([g(0,ke)],us)});import{webContents as eA}from"electron";var ic,gT=w(()=>{Q();K();hT();Wt();je();ic=class extends C{constructor(e,t){super();this.windowsMainService=t;this._onFoundInFrame=this._register(new x);this.onFoundInFrame=this._onFoundInFrame.event;this._register(new us(e))}async setIgnoreMenuShortcuts(e,t){let n;if(typeof e.windowId=="number"){let{windowId:i}=e,s=this.windowsMainService.getWindowById(i);if(!s?.win)throw new Error(`Invalid windowId: ${i}`);n=s.win.webContents}else{let{webContentsId:i}=e;if(n=eA.fromId(i),!n)throw new Error(`Invalid webContentsId: ${i}`)}n.isDestroyed()||n.setIgnoreMenuShortcuts(t)}async findInFrame(e,t,n,i){let a=this.getFrameByName(e,t);if(typeof a.findInFrame=="function"){a.findInFrame(n,{findNext:i.findNext,forward:i.forward});let l=(c,d)=>{d.finalUpdate&&(this._onFoundInFrame.fire(d),a.removeListener("found-in-frame",l))};a.on("found-in-frame",l)}}async stopFindInFrame(e,t,n){let s=this.getFrameByName(e,t);typeof s.stopFindInFrame=="function"&&s.stopFindInFrame(n.keepSelection?"keepSelection":"clearSelection")}getFrameByName(e,t){let n=this.windowsMainService.getWindowById(e.windowId);if(!n?.win)throw new Error(`Invalid windowId: ${e}`);let i=n.win.webContents.mainFrame.framesInSubtree.find(s=>s.name===t);if(!i)throw new Error(`Unknown frame: ${t}`);return i}};ic=T([g(0,ke),g(1,Le)],ic)});var oc,Nh=w(()=>{Z();oc=W("protocolMainService")});async function vT(o,r,e){let t=e&&e.get("storage.serviceMachineId",-1)||null;if(t)return t;try{let i=(await r.readFile(o.serviceMachineIdResource)).value.toString();t=lx(i)?i:null}catch{t=null}if(!t){t=xe();try{await r.writeFile(o.serviceMachineIdResource,H.fromString(t))}catch{}}return e?.store("storage.serviceMachineId",t,-1,1),t}var yT=w(()=>{nt();Mt();Hs()});async function wT(o,r,e,t,n,i,s){let a={"X-Market-Client-Id":`VSCode ${o}`,"User-Agent":`VSCode ${o} (${r.nameShort})`};if(_h(r,e)&&Yl(t)===3){let l=await vT(e,n,i);a["X-Market-User-Id"]=l,a["VSCode-SessionId"]=s.machineId||l}return a}var IT=w(()=>{yT();ir();cs()});function p(o,r){if(Ae(r)){let e=bT[r];if(e===void 0)throw new Error(`${o} references an unknown codicon: ${r}`);r=e}return bT[o]=r,{id:o}}var bT,bI=w(()=>{We();bT=Object.create(null)});var ST,xT=w(()=>{bI();ST={add:p("add",6e4),plus:p("plus",6e4),gistNew:p("gist-new",6e4),repoCreate:p("repo-create",6e4),lightbulb:p("lightbulb",60001),lightBulb:p("light-bulb",60001),repo:p("repo",60002),repoDelete:p("repo-delete",60002),gistFork:p("gist-fork",60003),repoForked:p("repo-forked",60003),gitPullRequest:p("git-pull-request",60004),gitPullRequestAbandoned:p("git-pull-request-abandoned",60004),recordKeys:p("record-keys",60005),keyboard:p("keyboard",60005),tag:p("tag",60006),gitPullRequestLabel:p("git-pull-request-label",60006),tagAdd:p("tag-add",60006),tagRemove:p("tag-remove",60006),person:p("person",60007),personFollow:p("person-follow",60007),personOutline:p("person-outline",60007),personFilled:p("person-filled",60007),sourceControl:p("source-control",60008),mirror:p("mirror",60009),mirrorPublic:p("mirror-public",60009),star:p("star",60010),starAdd:p("star-add",60010),starDelete:p("star-delete",60010),starEmpty:p("star-empty",60010),comment:p("comment",60011),commentAdd:p("comment-add",60011),alert:p("alert",60012),warning:p("warning",60012),search:p("search",60013),searchSave:p("search-save",60013),logOut:p("log-out",60014),signOut:p("sign-out",60014),logIn:p("log-in",60015),signIn:p("sign-in",60015),eye:p("eye",60016),eyeUnwatch:p("eye-unwatch",60016),eyeWatch:p("eye-watch",60016),circleFilled:p("circle-filled",60017),primitiveDot:p("primitive-dot",60017),closeDirty:p("close-dirty",60017),debugBreakpoint:p("debug-breakpoint",60017),debugBreakpointDisabled:p("debug-breakpoint-disabled",60017),debugHint:p("debug-hint",60017),terminalDecorationSuccess:p("terminal-decoration-success",60017),primitiveSquare:p("primitive-square",60018),edit:p("edit",60019),pencil:p("pencil",60019),info:p("info",60020),issueOpened:p("issue-opened",60020),gistPrivate:p("gist-private",60021),gitForkPrivate:p("git-fork-private",60021),lock:p("lock",60021),mirrorPrivate:p("mirror-private",60021),close:p("close",60022),removeClose:p("remove-close",60022),x:p("x",60022),repoSync:p("repo-sync",60023),sync:p("sync",60023),clone:p("clone",60024),desktopDownload:p("desktop-download",60024),beaker:p("beaker",60025),microscope:p("microscope",60025),vm:p("vm",60026),deviceDesktop:p("device-desktop",60026),file:p("file",60027),more:p("more",60028),ellipsis:p("ellipsis",60028),kebabHorizontal:p("kebab-horizontal",60028),mailReply:p("mail-reply",60029),reply:p("reply",60029),organization:p("organization",60030),organizationFilled:p("organization-filled",60030),organizationOutline:p("organization-outline",60030),newFile:p("new-file",60031),fileAdd:p("file-add",60031),newFolder:p("new-folder",60032),fileDirectoryCreate:p("file-directory-create",60032),trash:p("trash",60033),trashcan:p("trashcan",60033),history:p("history",60034),clock:p("clock",60034),folder:p("folder",60035),fileDirectory:p("file-directory",60035),symbolFolder:p("symbol-folder",60035),logoGithub:p("logo-github",60036),markGithub:p("mark-github",60036),github:p("github",60036),terminal:p("terminal",60037),console:p("console",60037),repl:p("repl",60037),zap:p("zap",60038),symbolEvent:p("symbol-event",60038),error:p("error",60039),stop:p("stop",60039),variable:p("variable",60040),symbolVariable:p("symbol-variable",60040),array:p("array",60042),symbolArray:p("symbol-array",60042),symbolModule:p("symbol-module",60043),symbolPackage:p("symbol-package",60043),symbolNamespace:p("symbol-namespace",60043),symbolObject:p("symbol-object",60043),symbolMethod:p("symbol-method",60044),symbolFunction:p("symbol-function",60044),symbolConstructor:p("symbol-constructor",60044),symbolBoolean:p("symbol-boolean",60047),symbolNull:p("symbol-null",60047),symbolNumeric:p("symbol-numeric",60048),symbolNumber:p("symbol-number",60048),symbolStructure:p("symbol-structure",60049),symbolStruct:p("symbol-struct",60049),symbolParameter:p("symbol-parameter",60050),symbolTypeParameter:p("symbol-type-parameter",60050),symbolKey:p("symbol-key",60051),symbolText:p("symbol-text",60051),symbolReference:p("symbol-reference",60052),goToFile:p("go-to-file",60052),symbolEnum:p("symbol-enum",60053),symbolValue:p("symbol-value",60053),symbolRuler:p("symbol-ruler",60054),symbolUnit:p("symbol-unit",60054),activateBreakpoints:p("activate-breakpoints",60055),archive:p("archive",60056),arrowBoth:p("arrow-both",60057),arrowDown:p("arrow-down",60058),arrowLeft:p("arrow-left",60059),arrowRight:p("arrow-right",60060),arrowSmallDown:p("arrow-small-down",60061),arrowSmallLeft:p("arrow-small-left",60062),arrowSmallRight:p("arrow-small-right",60063),arrowSmallUp:p("arrow-small-up",60064),arrowUp:p("arrow-up",60065),bell:p("bell",60066),bold:p("bold",60067),book:p("book",60068),bookmark:p("bookmark",60069),debugBreakpointConditionalUnverified:p("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:p("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:p("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:p("debug-breakpoint-data-unverified",60072),debugBreakpointData:p("debug-breakpoint-data",60073),debugBreakpointDataDisabled:p("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:p("debug-breakpoint-log-unverified",60074),debugBreakpointLog:p("debug-breakpoint-log",60075),debugBreakpointLogDisabled:p("debug-breakpoint-log-disabled",60075),briefcase:p("briefcase",60076),broadcast:p("broadcast",60077),browser:p("browser",60078),bug:p("bug",60079),calendar:p("calendar",60080),caseSensitive:p("case-sensitive",60081),check:p("check",60082),checklist:p("checklist",60083),chevronDown:p("chevron-down",60084),chevronLeft:p("chevron-left",60085),chevronRight:p("chevron-right",60086),chevronUp:p("chevron-up",60087),chromeClose:p("chrome-close",60088),chromeMaximize:p("chrome-maximize",60089),chromeMinimize:p("chrome-minimize",60090),chromeRestore:p("chrome-restore",60091),circleOutline:p("circle-outline",60092),circle:p("circle",60092),debugBreakpointUnverified:p("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:p("terminal-decoration-incomplete",60092),circleSlash:p("circle-slash",60093),circuitBoard:p("circuit-board",60094),clearAll:p("clear-all",60095),clippy:p("clippy",60096),closeAll:p("close-all",60097),cloudDownload:p("cloud-download",60098),cloudUpload:p("cloud-upload",60099),code:p("code",60100),collapseAll:p("collapse-all",60101),colorMode:p("color-mode",60102),commentDiscussion:p("comment-discussion",60103),creditCard:p("credit-card",60105),dash:p("dash",60108),dashboard:p("dashboard",60109),database:p("database",60110),debugContinue:p("debug-continue",60111),debugDisconnect:p("debug-disconnect",60112),debugPause:p("debug-pause",60113),debugRestart:p("debug-restart",60114),debugStart:p("debug-start",60115),debugStepInto:p("debug-step-into",60116),debugStepOut:p("debug-step-out",60117),debugStepOver:p("debug-step-over",60118),debugStop:p("debug-stop",60119),debug:p("debug",60120),deviceCameraVideo:p("device-camera-video",60121),deviceCamera:p("device-camera",60122),deviceMobile:p("device-mobile",60123),diffAdded:p("diff-added",60124),diffIgnored:p("diff-ignored",60125),diffModified:p("diff-modified",60126),diffRemoved:p("diff-removed",60127),diffRenamed:p("diff-renamed",60128),diff:p("diff",60129),diffSidebyside:p("diff-sidebyside",60129),discard:p("discard",60130),editorLayout:p("editor-layout",60131),emptyWindow:p("empty-window",60132),exclude:p("exclude",60133),extensions:p("extensions",60134),eyeClosed:p("eye-closed",60135),fileBinary:p("file-binary",60136),fileCode:p("file-code",60137),fileMedia:p("file-media",60138),filePdf:p("file-pdf",60139),fileSubmodule:p("file-submodule",60140),fileSymlinkDirectory:p("file-symlink-directory",60141),fileSymlinkFile:p("file-symlink-file",60142),fileZip:p("file-zip",60143),files:p("files",60144),filter:p("filter",60145),flame:p("flame",60146),foldDown:p("fold-down",60147),foldUp:p("fold-up",60148),fold:p("fold",60149),folderActive:p("folder-active",60150),folderOpened:p("folder-opened",60151),gear:p("gear",60152),gift:p("gift",60153),gistSecret:p("gist-secret",60154),gist:p("gist",60155),gitCommit:p("git-commit",60156),gitCompare:p("git-compare",60157),compareChanges:p("compare-changes",60157),gitMerge:p("git-merge",60158),githubAction:p("github-action",60159),githubAlt:p("github-alt",60160),globe:p("globe",60161),grabber:p("grabber",60162),graph:p("graph",60163),gripper:p("gripper",60164),heart:p("heart",60165),home:p("home",60166),horizontalRule:p("horizontal-rule",60167),hubot:p("hubot",60168),inbox:p("inbox",60169),issueReopened:p("issue-reopened",60171),issues:p("issues",60172),italic:p("italic",60173),jersey:p("jersey",60174),json:p("json",60175),bracket:p("bracket",60175),kebabVertical:p("kebab-vertical",60176),key:p("key",60177),law:p("law",60178),lightbulbAutofix:p("lightbulb-autofix",60179),linkExternal:p("link-external",60180),link:p("link",60181),listOrdered:p("list-ordered",60182),listUnordered:p("list-unordered",60183),liveShare:p("live-share",60184),loading:p("loading",60185),location:p("location",60186),mailRead:p("mail-read",60187),mail:p("mail",60188),markdown:p("markdown",60189),megaphone:p("megaphone",60190),mention:p("mention",60191),milestone:p("milestone",60192),gitPullRequestMilestone:p("git-pull-request-milestone",60192),mortarBoard:p("mortar-board",60193),move:p("move",60194),multipleWindows:p("multiple-windows",60195),mute:p("mute",60196),noNewline:p("no-newline",60197),note:p("note",60198),octoface:p("octoface",60199),openPreview:p("open-preview",60200),package:p("package",60201),paintcan:p("paintcan",60202),pin:p("pin",60203),play:p("play",60204),run:p("run",60204),plug:p("plug",60205),preserveCase:p("preserve-case",60206),preview:p("preview",60207),project:p("project",60208),pulse:p("pulse",60209),question:p("question",60210),quote:p("quote",60211),radioTower:p("radio-tower",60212),reactions:p("reactions",60213),references:p("references",60214),refresh:p("refresh",60215),regex:p("regex",60216),remoteExplorer:p("remote-explorer",60217),remote:p("remote",60218),remove:p("remove",60219),replaceAll:p("replace-all",60220),replace:p("replace",60221),repoClone:p("repo-clone",60222),repoForcePush:p("repo-force-push",60223),repoPull:p("repo-pull",60224),repoPush:p("repo-push",60225),report:p("report",60226),requestChanges:p("request-changes",60227),rocket:p("rocket",60228),rootFolderOpened:p("root-folder-opened",60229),rootFolder:p("root-folder",60230),rss:p("rss",60231),ruby:p("ruby",60232),saveAll:p("save-all",60233),saveAs:p("save-as",60234),save:p("save",60235),screenFull:p("screen-full",60236),screenNormal:p("screen-normal",60237),searchStop:p("search-stop",60238),server:p("server",60240),settingsGear:p("settings-gear",60241),settings:p("settings",60242),shield:p("shield",60243),smiley:p("smiley",60244),sortPrecedence:p("sort-precedence",60245),splitHorizontal:p("split-horizontal",60246),splitVertical:p("split-vertical",60247),squirrel:p("squirrel",60248),starFull:p("star-full",60249),starHalf:p("star-half",60250),symbolClass:p("symbol-class",60251),symbolColor:p("symbol-color",60252),symbolConstant:p("symbol-constant",60253),symbolEnumMember:p("symbol-enum-member",60254),symbolField:p("symbol-field",60255),symbolFile:p("symbol-file",60256),symbolInterface:p("symbol-interface",60257),symbolKeyword:p("symbol-keyword",60258),symbolMisc:p("symbol-misc",60259),symbolOperator:p("symbol-operator",60260),symbolProperty:p("symbol-property",60261),wrench:p("wrench",60261),wrenchSubaction:p("wrench-subaction",60261),symbolSnippet:p("symbol-snippet",60262),tasklist:p("tasklist",60263),telescope:p("telescope",60264),textSize:p("text-size",60265),threeBars:p("three-bars",60266),thumbsdown:p("thumbsdown",60267),thumbsup:p("thumbsup",60268),tools:p("tools",60269),triangleDown:p("triangle-down",60270),triangleLeft:p("triangle-left",60271),triangleRight:p("triangle-right",60272),triangleUp:p("triangle-up",60273),twitter:p("twitter",60274),unfold:p("unfold",60275),unlock:p("unlock",60276),unmute:p("unmute",60277),unverified:p("unverified",60278),verified:p("verified",60279),versions:p("versions",60280),vmActive:p("vm-active",60281),vmOutline:p("vm-outline",60282),vmRunning:p("vm-running",60283),watch:p("watch",60284),whitespace:p("whitespace",60285),wholeWord:p("whole-word",60286),window:p("window",60287),wordWrap:p("word-wrap",60288),zoomIn:p("zoom-in",60289),zoomOut:p("zoom-out",60290),listFilter:p("list-filter",60291),listFlat:p("list-flat",60292),listSelection:p("list-selection",60293),selection:p("selection",60293),listTree:p("list-tree",60294),debugBreakpointFunctionUnverified:p("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:p("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:p("debug-breakpoint-function-disabled",60296),debugStackframeActive:p("debug-stackframe-active",60297),circleSmallFilled:p("circle-small-filled",60298),debugStackframeDot:p("debug-stackframe-dot",60298),terminalDecorationMark:p("terminal-decoration-mark",60298),debugStackframe:p("debug-stackframe",60299),debugStackframeFocused:p("debug-stackframe-focused",60299),debugBreakpointUnsupported:p("debug-breakpoint-unsupported",60300),symbolString:p("symbol-string",60301),debugReverseContinue:p("debug-reverse-continue",60302),debugStepBack:p("debug-step-back",60303),debugRestartFrame:p("debug-restart-frame",60304),debugAlt:p("debug-alt",60305),callIncoming:p("call-incoming",60306),callOutgoing:p("call-outgoing",60307),menu:p("menu",60308),expandAll:p("expand-all",60309),feedback:p("feedback",60310),gitPullRequestReviewer:p("git-pull-request-reviewer",60310),groupByRefType:p("group-by-ref-type",60311),ungroupByRefType:p("ungroup-by-ref-type",60312),account:p("account",60313),gitPullRequestAssignee:p("git-pull-request-assignee",60313),bellDot:p("bell-dot",60314),debugConsole:p("debug-console",60315),library:p("library",60316),output:p("output",60317),runAll:p("run-all",60318),syncIgnored:p("sync-ignored",60319),pinned:p("pinned",60320),githubInverted:p("github-inverted",60321),serverProcess:p("server-process",60322),serverEnvironment:p("server-environment",60323),pass:p("pass",60324),issueClosed:p("issue-closed",60324),stopCircle:p("stop-circle",60325),playCircle:p("play-circle",60326),record:p("record",60327),debugAltSmall:p("debug-alt-small",60328),vmConnect:p("vm-connect",60329),cloud:p("cloud",60330),merge:p("merge",60331),export:p("export",60332),graphLeft:p("graph-left",60333),magnet:p("magnet",60334),notebook:p("notebook",60335),redo:p("redo",60336),checkAll:p("check-all",60337),pinnedDirty:p("pinned-dirty",60338),passFilled:p("pass-filled",60339),circleLargeFilled:p("circle-large-filled",60340),circleLarge:p("circle-large",60341),circleLargeOutline:p("circle-large-outline",60341),combine:p("combine",60342),gather:p("gather",60342),table:p("table",60343),variableGroup:p("variable-group",60344),typeHierarchy:p("type-hierarchy",60345),typeHierarchySub:p("type-hierarchy-sub",60346),typeHierarchySuper:p("type-hierarchy-super",60347),gitPullRequestCreate:p("git-pull-request-create",60348),runAbove:p("run-above",60349),runBelow:p("run-below",60350),notebookTemplate:p("notebook-template",60351),debugRerun:p("debug-rerun",60352),workspaceTrusted:p("workspace-trusted",60353),workspaceUntrusted:p("workspace-untrusted",60354),workspaceUnknown:p("workspace-unknown",60355),terminalCmd:p("terminal-cmd",60356),terminalDebian:p("terminal-debian",60357),terminalLinux:p("terminal-linux",60358),terminalPowershell:p("terminal-powershell",60359),terminalTmux:p("terminal-tmux",60360),terminalUbuntu:p("terminal-ubuntu",60361),terminalBash:p("terminal-bash",60362),arrowSwap:p("arrow-swap",60363),copy:p("copy",60364),personAdd:p("person-add",60365),filterFilled:p("filter-filled",60366),wand:p("wand",60367),debugLineByLine:p("debug-line-by-line",60368),inspect:p("inspect",60369),layers:p("layers",60370),layersDot:p("layers-dot",60371),layersActive:p("layers-active",60372),compass:p("compass",60373),compassDot:p("compass-dot",60374),compassActive:p("compass-active",60375),azure:p("azure",60376),issueDraft:p("issue-draft",60377),gitPullRequestClosed:p("git-pull-request-closed",60378),gitPullRequestDraft:p("git-pull-request-draft",60379),debugAll:p("debug-all",60380),debugCoverage:p("debug-coverage",60381),runErrors:p("run-errors",60382),folderLibrary:p("folder-library",60383),debugContinueSmall:p("debug-continue-small",60384),beakerStop:p("beaker-stop",60385),graphLine:p("graph-line",60386),graphScatter:p("graph-scatter",60387),pieChart:p("pie-chart",60388),bracketDot:p("bracket-dot",60389),bracketError:p("bracket-error",60390),lockSmall:p("lock-small",60391),azureDevops:p("azure-devops",60392),verifiedFilled:p("verified-filled",60393),newline:p("newline",60394),layout:p("layout",60395),layoutActivitybarLeft:p("layout-activitybar-left",60396),layoutActivitybarRight:p("layout-activitybar-right",60397),layoutPanelLeft:p("layout-panel-left",60398),layoutPanelCenter:p("layout-panel-center",60399),layoutPanelJustify:p("layout-panel-justify",60400),layoutPanelRight:p("layout-panel-right",60401),layoutPanel:p("layout-panel",60402),layoutSidebarLeft:p("layout-sidebar-left",60403),layoutSidebarRight:p("layout-sidebar-right",60404),layoutStatusbar:p("layout-statusbar",60405),layoutMenubar:p("layout-menubar",60406),layoutCentered:p("layout-centered",60407),target:p("target",60408),indent:p("indent",60409),recordSmall:p("record-small",60410),errorSmall:p("error-small",60411),terminalDecorationError:p("terminal-decoration-error",60411),arrowCircleDown:p("arrow-circle-down",60412),arrowCircleLeft:p("arrow-circle-left",60413),arrowCircleRight:p("arrow-circle-right",60414),arrowCircleUp:p("arrow-circle-up",60415),layoutSidebarRightOff:p("layout-sidebar-right-off",60416),layoutPanelOff:p("layout-panel-off",60417),layoutSidebarLeftOff:p("layout-sidebar-left-off",60418),blank:p("blank",60419),heartFilled:p("heart-filled",60420),map:p("map",60421),mapHorizontal:p("map-horizontal",60421),foldHorizontal:p("fold-horizontal",60421),mapFilled:p("map-filled",60422),mapHorizontalFilled:p("map-horizontal-filled",60422),foldHorizontalFilled:p("fold-horizontal-filled",60422),circleSmall:p("circle-small",60423),bellSlash:p("bell-slash",60424),bellSlashDot:p("bell-slash-dot",60425),commentUnresolved:p("comment-unresolved",60426),gitPullRequestGoToChanges:p("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:p("git-pull-request-new-changes",60428),searchFuzzy:p("search-fuzzy",60429),commentDraft:p("comment-draft",60430),send:p("send",60431),sparkle:p("sparkle",60432),insert:p("insert",60433),mic:p("mic",60434),thumbsdownFilled:p("thumbsdown-filled",60435),thumbsupFilled:p("thumbsup-filled",60436),coffee:p("coffee",60437),snake:p("snake",60438),game:p("game",60439),vr:p("vr",60440),chip:p("chip",60441),piano:p("piano",60442),music:p("music",60443),micFilled:p("mic-filled",60444),repoFetch:p("repo-fetch",60445),copilot:p("copilot",60446),lightbulbSparkle:p("lightbulb-sparkle",60447),robot:p("robot",60448),sparkleFilled:p("sparkle-filled",60449),diffSingle:p("diff-single",60450),diffMultiple:p("diff-multiple",60451),surroundWith:p("surround-with",60452),share:p("share",60453),gitStash:p("git-stash",60454),gitStashApply:p("git-stash-apply",60455),gitStashPop:p("git-stash-pop",60456),vscode:p("vscode",60457),vscodeInsiders:p("vscode-insiders",60458),codeOss:p("code-oss",60459),runCoverage:p("run-coverage",60460),runAllCoverage:p("run-all-coverage",60461),coverage:p("coverage",60462),githubProject:p("github-project",60463),mapVertical:p("map-vertical",60464),foldVertical:p("fold-vertical",60464),mapVerticalFilled:p("map-vertical-filled",60465),foldVerticalFilled:p("fold-vertical-filled",60465),goToSearch:p("go-to-search",60466),percentage:p("percentage",60467),sortPercentage:p("sort-percentage",60467),attach:p("attach",60468),goToEditingSession:p("go-to-editing-session",60469),editSession:p("edit-session",60470),codeReview:p("code-review",60471),copilotWarning:p("copilot-warning",60472),python:p("python",60473),copilotLarge:p("copilot-large",60474),copilotWarningLarge:p("copilot-warning-large",60475),keyboardTab:p("keyboard-tab",60476),copilotBlocked:p("copilot-blocked",60477),copilotNotConnected:p("copilot-not-connected",60478),flag:p("flag",60479),lightbulbEmpty:p("lightbulb-empty",60480),symbolMethodArrow:p("symbol-method-arrow",60481),copilotUnavailable:p("copilot-unavailable",60482),repoPinned:p("repo-pinned",60483),keyboardTabAbove:p("keyboard-tab-above",60484),keyboardTabBelow:p("keyboard-tab-below",60485),gitPullRequestDone:p("git-pull-request-done",60486),mcp:p("mcp",60487),extensionsLarge:p("extensions-large",60488),layoutPanelDock:p("layout-panel-dock",60489),layoutSidebarLeftDock:p("layout-sidebar-left-dock",60490),layoutSidebarRightDock:p("layout-sidebar-right-dock",60491),copilotInProgress:p("copilot-in-progress",60492),copilotError:p("copilot-error",60493),copilotSuccess:p("copilot-success",60494),chatSparkle:p("chat-sparkle",60495),searchSparkle:p("search-sparkle",60496),editSparkle:p("edit-sparkle",60497),copilotSnooze:p("copilot-snooze",60498),sendToRemoteAgent:p("send-to-remote-agent",60499),commentDiscussionSparkle:p("comment-discussion-sparkle",60500),chatSparkleWarning:p("chat-sparkle-warning",60501),chatSparkleError:p("chat-sparkle-error",60502),collection:p("collection",60503),newCollection:p("new-collection",60504),thinking:p("thinking",60505),build:p("build",60506),commentDiscussionQuote:p("comment-discussion-quote",60507),cursor:p("cursor",60508),eraser:p("eraser",60509),fileText:p("file-text",60510),quotes:p("quotes",60512),rename:p("rename",60513),runWithDeps:p("run-with-deps",60514),debugConnected:p("debug-connected",60515),strikethrough:p("strikethrough",60516),openInProduct:p("open-in-product",60517),indexZero:p("index-zero",60518),agent:p("agent",60519),editCode:p("edit-code",60520),repoSelected:p("repo-selected",60521),skip:p("skip",60522),mergeInto:p("merge-into",60523),gitBranchChanges:p("git-branch-changes",60524),gitBranchStagedChanges:p("git-branch-staged-changes",60525),gitBranchConflicts:p("git-branch-conflicts",60526),gitBranch:p("git-branch",60527),gitBranchCreate:p("git-branch-create",60527),gitBranchDelete:p("git-branch-delete",60527),searchLarge:p("search-large",60528),terminalGitBash:p("terminal-git-bash",60529),windowActive:p("window-active",60530),forward:p("forward",60531),download:p("download",60532),clockface:p("clockface",60533),unarchive:p("unarchive",60534),sessionInProgress:p("session-in-progress",60535),collectionSmall:p("collection-small",60536),vmSmall:p("vm-small",60537),cloudSmall:p("cloud-small",60538),addSmall:p("add-small",60539),removeSmall:p("remove-small",60540),worktreeSmall:p("worktree-small",60541),worktree:p("worktree",60542),screenCut:p("screen-cut",60543),ask:p("ask",60544),openai:p("openai",60545),claude:p("claude",60546),openInWindow:p("open-in-window",60547),newSession:p("new-session",60548),cascade:p("cascade",63742),cascadeBrowser:p("cascade-browser",63743),deepwiki:p("deepwiki",63744)}});function SI(){return Object.values(mt)}var tA,mt,Qu=w(()=>{bI();xT();tA={dialogError:p("dialog-error","error"),dialogWarning:p("dialog-warning","warning"),dialogInfo:p("dialog-info","info"),dialogClose:p("dialog-close","close"),treeItemExpanded:p("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:p("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:p("tree-filter-on-type-off","list-selection"),treeFilterClear:p("tree-filter-clear","close"),treeItemLoading:p("tree-item-loading","loading"),menuSelection:p("menu-selection","check"),menuSubmenu:p("menu-submenu","chevron-right"),menuBarMore:p("menubar-more","more"),scrollbarButtonLeft:p("scrollbar-button-left","triangle-left"),scrollbarButtonRight:p("scrollbar-button-right","triangle-right"),scrollbarButtonUp:p("scrollbar-button-up","triangle-up"),scrollbarButtonDown:p("scrollbar-button-down","triangle-down"),toolBarMore:p("toolbar-more","more"),quickInputBack:p("quick-input-back","arrow-left"),dropDownButton:p("drop-down-button",60084),symbolCustomColor:p("symbol-customcolor",60252),exportIcon:p("export",60332),workspaceUnspecified:p("workspace-unspecified",60355),newLine:p("newline",60394),thumbsDownFilled:p("thumbsdown-filled",60435),thumbsUpFilled:p("thumbsup-filled",60436),gitFetch:p("git-fetch",60445),lightbulbSparkleAutofix:p("lightbulb-sparkle-autofix",60447),debugBreakpointPending:p("debug-breakpoint-pending",60377)},mt={...ST,...tA}});var PT,sc,xI=w(()=>{Qu();(r=>{function o(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}r.isThemeColor=o})(PT||={});(I=>{I.iconNameSegment="[A-Za-z0-9]+",I.iconNameExpression="[A-Za-z0-9-]+",I.iconModifierExpression="~[A-Za-z]+",I.iconNameCharacter="[A-Za-z0-9~-]";let n=new RegExp(`^(${I.iconNameExpression})(${I.iconModifierExpression})?$`);function i(k){let R=n.exec(k.id);if(!R)return i(mt.error);let[,D,F]=R,ce=["codicon","codicon-"+D];return F&&ce.push("codicon-modifier-"+F.substring(1)),ce}I.asClassNameArray=i;function s(k){return i(k).join(" ")}I.asClassName=s;function a(k){return"."+i(k).join(".")}I.asCSSSelector=a;function l(k){return!!k&&typeof k=="object"&&typeof k.id=="string"&&(typeof k.color>"u"||PT.isThemeColor(k.color))}I.isThemeIcon=l;let c=new RegExp(`^\\$\\((${I.iconNameExpression}(?:${I.iconModifierExpression})?)\\)$`);function d(k){let R=c.exec(k);if(!R)return;let[,D]=R;return{id:D}}I.fromString=d;function u(k){return{id:k}}I.fromId=u;function f(k,R){let D=k.id,F=D.lastIndexOf("~");return F!==-1&&(D=D.substring(0,F)),R&&(D=`${D}~${R}`),{id:D}}I.modify=f;function m(k){let R=k.id.lastIndexOf("~");if(R!==-1)return k.id.substring(R+1)}I.getModifier=m;function y(k,R){return k.id===R.id&&k.color?.id===R.color?.id}I.isEqual=y;function v(k){return k?.id===mt.file.id}I.isFile=v;function S(k){return k?.id===mt.folder.id}I.isFolder=S})(sc||={})});import un,{screen as nA}from"electron";import{release as ET}from"os";var PI,Xu,la,EI,TI=w(()=>{he();St();Ro();Q();K();ze();ai();Y();se();Ce();Sl();st();js();Ot();Ol();je();xt();re();Qt();Nh();IT();hu();ir();xI();pl();no();Wt();hr();jo();xi();ri();Jr();qo();Xl();Z();nt();Ve();Yw();Ty();PI=class o{constructor(){this.windows=new Set}static{this.INSTANCE=new o}acquireBadge(r){return this.windows.add(r.id),un.app.setBadgeCount(ne?1:void 0),{dispose:()=>{this.windows.delete(r.id),this.windows.size===0&&un.app.setBadgeCount(0)}}}},Xu=class o extends C{constructor(e,t,n,i){super();this.configurationService=e;this.stateService=t;this.environmentMainService=n;this.logService=i;this._onDidClose=this._register(new x);this.onDidClose=this._onDidClose.event;this._onDidMaximize=this._register(new x);this.onDidMaximize=this._onDidMaximize.event;this._onDidUnmaximize=this._register(new x);this.onDidUnmaximize=this._onDidUnmaximize.event;this._onDidTriggerSystemContextMenu=this._register(new x);this.onDidTriggerSystemContextMenu=this._onDidTriggerSystemContextMenu.event;this._onDidEnterFullScreen=this._register(new x);this.onDidEnterFullScreen=this._onDidEnterFullScreen.event;this._onDidLeaveFullScreen=this._register(new x);this.onDidLeaveFullScreen=this._onDidLeaveFullScreen.event;this._onDidChangeAlwaysOnTop=this._register(new x);this.onDidChangeAlwaysOnTop=this._onDidChangeAlwaysOnTop.event;this._lastFocusTime=Date.now();this._win=null;this.notifyFocusDisposable=this._register(new er);this.windowControlsDimmed=!1;this.transientIsNativeFullScreen=void 0;this.joinNativeFullScreenTransition=void 0}get lastFocusTime(){return this._lastFocusTime}get win(){return this._win}setWin(e,t){this._win=e,this._register(E.fromNodeEventEmitter(e,"maximize")(()=>{if(M&&this.environmentMainService.enableRDPDisplayTracking&&this._win){let[i,s]=this._win.getPosition(),[a,l]=this._win.getSize();this.maximizedWindowState={mode:0,width:a,height:l,x:i,y:s},this.logService.debug(`Saved maximized window ${this.id} display state:`,this.maximizedWindowState)}this._onDidMaximize.fire()})),this._register(E.fromNodeEventEmitter(e,"unmaximize")(()=>{M&&this.environmentMainService.enableRDPDisplayTracking&&this.maximizedWindowState&&(this.maximizedWindowState=void 0,this.logService.debug(`Cleared maximized window ${this.id} state`)),this._onDidUnmaximize.fire()})),this._register(E.fromNodeEventEmitter(e,"closed")(()=>{this._onDidClose.fire(),this.dispose()})),this._register(E.fromNodeEventEmitter(e,"focus")(()=>{this.clearNotifyFocus(),this._lastFocusTime=Date.now()})),this._register(E.fromNodeEventEmitter(this._win,"enter-full-screen")(()=>this._onDidEnterFullScreen.fire())),this._register(E.fromNodeEventEmitter(this._win,"leave-full-screen")(()=>this._onDidLeaveFullScreen.fire())),this._register(E.fromNodeEventEmitter(this._win,"always-on-top-changed",(i,s)=>s)(i=>this._onDidChangeAlwaysOnTop.fire(i)));let n=!Bo(this.configurationService,t?.titleBarStyle==="hidden"?"custom":void 0);if(V&&n&&e.setSheetOffset(Xg(ET())?32:28),n&&lu(this.configurationService)){let i=this.stateService.getItem(o.windowControlHeightStateStorageKey);i?this.updateWindowControls({height:i}):this.updateWindowControls({height:Xx})}(M||ne)&&n&&this._register(E.fromNodeEventEmitter(e,"system-context-menu",(i,s)=>({event:i,point:s}))(i=>{let[s,a]=e.getPosition(),l=un.screen.screenToDipPoint(i.point),c=Math.floor(l.x)-s,d=Math.floor(l.y)-a;ne&&c>35&&(i.event.preventDefault(),this._onDidTriggerSystemContextMenu.fire({x:c,y:d}))})),this.environmentMainService.args["open-devtools"]===!0&&e.webContents.openDevTools(),V&&(this._register(this.onDidEnterFullScreen(()=>{this.joinNativeFullScreenTransition?.complete(!0)})),this._register(this.onDidLeaveFullScreen(()=>{this.joinNativeFullScreenTransition?.complete(!0)}))),M&&this.environmentMainService.enableRDPDisplayTracking&&this._register(E.fromNodeEventEmitter(nA,"display-added",(i,s)=>({event:i,display:s}))(i=>{this.onDisplayAdded(i.display)}))}onDisplayAdded(e){let t=this.maximizedWindowState;t&&this._win&&ml.validateWindowStateOnDisplay(t,e)&&(this.logService.debug(`Setting maximized window ${this.id} bounds to match newly added display`,t),this._win.setBounds(t))}applyState(e,t=un.screen.getAllDisplays().length>0){let n=this.configurationService.getValue("window"),i=V&&n?.nativeTabs===!0;(V||M)&&t&&(!i||Ei().length===1)&&[e.width,e.height,e.x,e.y].every(s=>typeof s=="number")&&this._win?.setBounds({width:e.width,height:e.height,x:e.x,y:e.y}),(e.mode===0||e.mode===3)&&(this._win?.maximize(),e.mode===3&&this.setFullScreen(!0,!0),this._win?.show())}setRepresentedFilename(e){V?this.win?.setRepresentedFilename(e):this.representedFilename=e}getRepresentedFilename(){return V?this.win?.getRepresentedFilename():this.representedFilename}setDocumentEdited(e){V&&this.win?.setDocumentEdited(e),this.documentEdited=e}isDocumentEdited(){return V?!!this.win?.isDocumentEdited():!!this.documentEdited}focus(e){switch(e?.mode??0){case 0:this.doFocusWindow();break;case 1:this.showNotifyFocus();break;case 2:V&&un.app.focus({steal:!0}),this.doFocusWindow();break}}showNotifyFocus(){let e=new te;this.notifyFocusDisposable.value=e,e.add(PI.INSTANCE.acquireBadge(this)),M||ne?(this.win?.flashFrame(!0),e.add(j(()=>this.win?.flashFrame(!1)))):V&&un.app.dock?.bounce("informational")}clearNotifyFocus(){this.notifyFocusDisposable.clear()}doFocusWindow(){let e=this.win;e&&(e.isMinimized()&&e.restore(),e.focus(),e.webContents.focus())}static{this.windowControlHeightStateStorageKey="windowControlHeight"}updateWindowControls(e){let t=this.win;if(t){if(e.height&&this.stateService.setItem(la.windowControlHeightStateStorageKey,e.height),!V&&lu(this.configurationService)){e.dimmed!==void 0&&(this.windowControlsDimmed=e.dimmed);let n=e.backgroundColor??this.lastWindowControlColors?.backgroundColor,i=e.foregroundColor??this.lastWindowControlColors?.foregroundColor;(e.backgroundColor!==void 0||e.foregroundColor!==void 0)&&(this.lastWindowControlColors={backgroundColor:n,foregroundColor:i});let s=this.windowControlsDimmed&&n?this.dimColor(n):n,a=this.windowControlsDimmed&&i?this.dimColor(i):i;t.setTitleBarOverlay({color:s?.trim()===""?void 0:s,symbolColor:a?.trim()===""?void 0:a,height:e.height?e.height-1:void 0})}else if(V&&e.height!==void 0){let n=Xg(ET())?14:16,i=Math.floor((e.height-n)/2);i?t.setWindowButtonPosition({x:i+1,y:i}):t.setWindowButtonPosition(null)}}}dimColor(e){let t=Ko.Format.CSS.parse(e);if(!t)return e;let n=.7,i=Math.round(t.rgba.r*n),s=Math.round(t.rgba.g*n),a=Math.round(t.rgba.b*n);return`rgb(${i}, ${s}, ${a})`}toggleFullScreen(){this.setFullScreen(!this.isFullScreen,!1)}setFullScreen(e,t){lm(this.configurationService)?this.setNativeFullScreen(e,t):this.setSimpleFullScreen(e)}get isFullScreen(){if(V&&typeof this.transientIsNativeFullScreen=="boolean")return this.transientIsNativeFullScreen;let e=this.win,t=e?.isFullScreen(),n=e?.isSimpleFullScreen();return!!(t||n)}setNativeFullScreen(e,t){let n=this.win;n?.isSimpleFullScreen()&&n?.setSimpleFullScreen(!1),this.doSetNativeFullScreen(e,t)}doSetNativeFullScreen(e,t){if(V){this.transientIsNativeFullScreen=e;let i=this.joinNativeFullScreenTransition=new Gt;(async()=>{let s=await Promise.race([i.p,lt(1e4).then(()=>!1)]);this.joinNativeFullScreenTransition===i&&(this.transientIsNativeFullScreen=void 0,this.joinNativeFullScreenTransition=void 0,!s&&e&&t&&this.win&&!this.win.isFullScreen()&&(this.logService.warn("window: native macOS fullscreen transition did not happen within 10s from restoring"),this._onDidLeaveFullScreen.fire()))})()}this.win?.setFullScreen(e)}setSimpleFullScreen(e){let t=this.win;t?.isFullScreen()&&this.doSetNativeFullScreen(!1,!1),t?.setSimpleFullScreen(e),t?.webContents.focus()}dispose(){super.dispose(),this._win=null}},la=class extends Xu{constructor(e,t,n,i,s,a,l,c,d,u,f,m,y,v,S,I,k,R,D,F,ce){super(u,F,i,t);this.loggerMainService=n;this.policyService=s;this.userDataProfilesService=a;this.fileService=l;this.applicationStorageMainService=c;this.storageMainService=d;this.themeMainService=f;this.workspacesManagementMainService=m;this.backupMainService=y;this.telemetryService=v;this.dialogMainService=S;this.lifecycleMainService=I;this.productService=k;this.windowsMainService=D;this._onWillLoad=this._register(new x);this.onWillLoad=this._onWillLoad.event;this._onDidSignalReady=this._register(new x);this.onDidSignalReady=this._onDidSignalReady.event;this._onDidDestroy=this._register(new x);this.onDidDestroy=this._onDidDestroy.event;this.whenReadyCallbacks=[];this.touchBarGroups=[];this.currentHttpProxy=void 0;this.currentNoProxy=void 0;this.customZoomLevel=void 0;this.wasLoaded=!1;this.readyState=0;this.swipeListenerDisposable=this._register(new er);{this.configObjectUrl=this._register(R.createIPCObjectUrl());let[z,Pe]=this.restoreWindowState(e.state);this.windowState=z,this.logService.trace("window#ctor: using window state",z);let Pt=ce.invokeFunction(fl,this.windowState,void 0,{preload:et.asFileUri("vs/base/parts/sandbox/electron-browser/preload.js").fsPath,additionalArguments:[`--vscode-window-config=${this.configObjectUrl.resource.toString()}`],v8CacheOptions:this.environmentMainService.useCodeCache?"bypassHeatCheck":"none"});Ne("code/willCreateCodeBrowserWindow"),this._win=new un.BrowserWindow(Pt),Ne("code/didCreateCodeBrowserWindow"),this._id=this._win.id,this.setWin(this._win,Pt),this.applyState(this.windowState,Pe),this._lastFocusTime=Date.now()}let B=parseInt(this.environmentMainService.args["unresponsive-sample-interval"]||"1000"),ee=parseInt(this.environmentMainService.args["unresponsive-sample-period"]||"15000");(B<=0||ee<=0||B>ee)&&(this.logService.warn(`Invalid unresponsive sample interval (${B}ms) or period (${ee}ms), using defaults.`),B=1e3,ee=15e3),this.jsCallStackMap=new Map,this.jsCallStackEffectiveSampleCount=Math.round(ee/B),this.jsCallStackCollector=this._register(new _s(B)),this.jsCallStackCollectorStopScheduler=this._register(new pr(()=>{this.stopCollectingJScallStacks()},ee)),this.onConfigurationUpdated(),this.createTouchBar(),this.registerListeners()}get id(){return this._id}get backupPath(){return this._config?.backupPath}get openedWorkspace(){return this._config?.workspace}get profile(){if(!this.config)return;let e=this.userDataProfilesService.profiles.find(t=>t.id===this.config?.profiles.profile.id);return this.isExtensionDevelopmentHost&&e?e:this.userDataProfilesService.getProfileForWorkspace(this.config.workspace??No(this.backupPath,this.isExtensionDevelopmentHost))??this.userDataProfilesService.defaultProfile}get remoteAuthority(){return this._config?.remoteAuthority}get config(){return this._config}get isExtensionDevelopmentHost(){return!!this._config?.extensionDevelopmentPath}get isExtensionTestHost(){return!!this._config?.extensionTestsPath}get isExtensionDevelopmentTestFromCli(){return this.isExtensionDevelopmentHost&&this.isExtensionTestHost&&!this._config?.debugId}setReady(){for(this.logService.trace(`window#load: window reported ready (id: ${this._id})`),this.readyState=2;this.whenReadyCallbacks.length;)this.whenReadyCallbacks.pop()(this);this._onDidSignalReady.fire()}ready(){return new Promise(e=>{if(this.isReady)return e(this);this.whenReadyCallbacks.push(e)})}get isReady(){return this.readyState===2}get whenClosedOrLoaded(){return new Promise(e=>{function t(){n.dispose(),i.dispose(),e()}let n=this.onDidClose(()=>t()),i=this.onWillLoad(()=>t())})}registerListeners(){this._register(E.fromNodeEventEmitter(this._win,"unresponsive")(()=>this.onWindowError(1))),this._register(E.fromNodeEventEmitter(this._win,"responsive")(()=>this.onWindowError(4))),this._register(E.fromNodeEventEmitter(this._win.webContents,"render-process-gone",(t,n)=>n)(t=>this.onWindowError(2,{...t}))),this._register(E.fromNodeEventEmitter(this._win.webContents,"did-fail-load",(t,n,i)=>({exitCode:n,reason:i}))(({exitCode:t,reason:n})=>this.onWindowError(3,{reason:n,exitCode:t}))),this._register(E.fromNodeEventEmitter(this._win.webContents,"will-prevent-unload")(t=>t.preventDefault())),this._register(E.fromNodeEventEmitter(this._win.webContents,"did-finish-load")(()=>{this.pendingLoadConfig&&(this._config=this.pendingLoadConfig,this.pendingLoadConfig=void 0)})),this._register(this.onDidMaximize(()=>{this._config&&(this._config.maximized=!0)})),this._register(this.onDidUnmaximize(()=>{this._config&&(this._config.maximized=!1)})),this._register(this.onDidEnterFullScreen(()=>{this.sendWhenReady("vscode:enterFullScreen",be.None)})),this._register(this.onDidLeaveFullScreen(()=>{this.sendWhenReady("vscode:leaveFullScreen",be.None)})),this._register(E.fromNodeEventEmitter(this._win.webContents,"devtools-open-url",(t,n)=>n)(t=>{this.onDevToolsOpenUrl(t)})),this._register(this.configurationService.onDidChangeConfiguration(t=>this.onConfigurationUpdated(t))),this._register(this.workspacesManagementMainService.onDidDeleteUntitledWorkspace(t=>this.onDidDeleteUntitledWorkspace(t)));let e=["https://*.vsassets.io/*"];if(this.productService.extensionsGallery?.serviceUrl){let t=b.parse(this.productService.extensionsGallery.serviceUrl);e.push(`${t.scheme}://${t.authority}/*`)}this._win.webContents.session.webRequest.onBeforeSendHeaders({urls:e},async(t,n)=>{let i=await this.getMarketplaceHeaders();n({cancel:!1,requestHeaders:Object.assign(t.requestHeaders,i)})})}onDevToolsOpenUrl(e){if(!e.startsWith("file:///"))return;let n=b.parse(e).fsPath,i,s,a=/^(.+?):(\d+)(?::(\d+))?$/.exec(n);a&&a[1]&&(n=a[1],i=parseInt(a[2]),s=a[3]?parseInt(a[3]):void 0);let l=b.file(n),c=i?{selection:{startLineNumber:i,startColumn:s??1,endLineNumber:i,endColumn:s??1}}:void 0;this.sendWhenReady("vscode:openFiles",be.None,{filesToOpenOrCreate:[{fileUri:l.toJSON(),options:c}]})}getMarketplaceHeaders(){return this.marketplaceHeadersPromise||(this.marketplaceHeadersPromise=wT(this.productService.version,this.productService,this.environmentMainService,this.configurationService,this.fileService,this.applicationStorageMainService,this.telemetryService)),this.marketplaceHeadersPromise}async onWindowError(e,t){switch(e){case 2:this.logService.error(`CodeWindow: renderer process gone (reason: ${t?.reason||"<unknown>"}, code: ${t?.exitCode||"<unknown>"})`);break;case 1:this.logService.error("CodeWindow: detected unresponsive");break;case 4:this.logService.error("CodeWindow: recovered from unresponsive");break;case 3:this.logService.error(`CodeWindow: failed to load (reason: ${t?.reason||"<unknown>"}, code: ${t?.exitCode||"<unknown>"})`);break}switch(this.telemetryService.publicLog2("windowerror",{type:e,reason:t?.reason,code:t?.exitCode}),e){case 1:case 2:if(this.isExtensionDevelopmentTestFromCli){this.lifecycleMainService.kill(1);return}if(this.environmentMainService.args["enable-smoke-test-driver"]){await this.destroyWindow(!1,!1),this.lifecycleMainService.quit();return}if(e===1){if(this.isExtensionDevelopmentHost||this.isExtensionTestHost||this._win?.webContents?.isDevToolsOpened())return;this.jsCallStackCollector.trigger(()=>this.startCollectingJScallStacks()),this.jsCallStackCollectorStopScheduler.schedule();let{response:n,checkboxChecked:i}=await this.dialogMainService.showMessageBox({type:"warning",buttons:[h(2736,null),h(2732,null),h(2737,null)],message:h(2730,null),detail:h(2731,null),checkboxLabel:this._config?.workspace?h(2733,null):void 0},this._win);if(n!==2){let s=n===0;this.stopCollectingJScallStacks(),await this.destroyWindow(s,i)}}else if(e===2){let n;t?n=h(2728,null,t.reason,t.exitCode??"<unknown>"):n=h(2726,null);let{response:i,checkboxChecked:s}=await this.dialogMainService.showMessageBox({type:"warning",buttons:[this._config?.workspace?h(2736,null):h(2735,null),h(2732,null)],message:n,detail:this._config?.workspace?h(2729,null):h(2727,null),checkboxLabel:this._config?.workspace?h(2733,null):void 0},this._win),a=i===0;await this.destroyWindow(a,s)}break;case 4:this.stopCollectingJScallStacks();break}}async destroyWindow(e,t){let n=this._config?.workspace;if(t&&n)try{let i=this.storageMainService.workspaceStorage(n);await i.init(),i.delete("memento/workbench.parts.editor"),await i.close()}catch(i){this.logService.error(i)}this._onDidDestroy.fire();try{if(e&&this._config){let i,s;Rt(n)?i={folderUri:n.uri}:it(n)?i={workspaceUri:n.configPath}:s=!0,(await this.windowsMainService.open({context:5,userEnv:this._config.userEnv,cli:{...this.environmentMainService.args,_:[]},urisToOpen:i?[i]:void 0,forceEmpty:s,forceNewWindow:!0,remoteAuthority:this.remoteAuthority})).at(0)?.focus()}}finally{this._win?.destroy()}}onDidDeleteUntitledWorkspace(e){this._config?.workspace?.id===e.id&&(this._config.workspace=void 0)}onConfigurationUpdated(e){if(V&&(!e||e.affectsConfiguration("workbench.editor.swipeToNavigate"))&&(this.configurationService.getValue("workbench.editor.swipeToNavigate")?this.registerSwipeListener():this.swipeListenerDisposable.clear()),!e||e.affectsConfiguration("window.menuBarVisibility")){let t=this.getMenuBarVisibility();t!==this.currentMenuBarVisibility&&(this.currentMenuBarVisibility=t,this.setMenuBarVisibility(t))}if(!e||e.affectsConfiguration("http.proxy")||e.affectsConfiguration("http.noProxy")){let n=(this.configurationService.inspect("http.proxy").userLocalValue||"").trim()||(process.env.https_proxy||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.HTTP_PROXY||"").trim()||void 0;if(n?.indexOf("@")!==-1){let s=b.parse(n),a=s.authority.indexOf("@");a!==-1&&(n=s.with({authority:s.authority.substring(a+1)}).toString())}n?.endsWith("/")&&(n=n.substr(0,n.length-1));let i=(this.configurationService.getValue("http.noProxy")||[]).map(s=>s.trim()).join(",")||(process.env.no_proxy||process.env.NO_PROXY||"").trim()||void 0;if((n||"").indexOf("@")===-1&&(n!==this.currentHttpProxy||i!==this.currentNoProxy)){this.currentHttpProxy=n,this.currentNoProxy=i;let s=n||"",a=i?`${i},<local>`:"<local>";this.logService.trace(`Setting proxy to '${s}', bypassing '${a}'`),this._win.webContents.session.setProxy({proxyRules:s,proxyBypassRules:a,pacScript:""}),un.app.setProxy({proxyRules:s,proxyBypassRules:a,pacScript:""})}}}registerSwipeListener(){this.swipeListenerDisposable.value=E.fromNodeEventEmitter(this._win,"swipe",(e,t)=>t)(e=>{this.isReady&&(e==="left"?this.send("vscode:runAction",{id:"workbench.action.openPreviousRecentlyUsedEditor",from:"mouse"}):e==="right"&&this.send("vscode:runAction",{id:"workbench.action.openNextRecentlyUsedEditor",from:"mouse"}))})}addTabbedWindow(e){V&&e.win&&this._win.addTabbedWindow(e.win)}load(e,t=Object.create(null)){this.logService.trace(`window#load: attempt to load window (id: ${this._id})`),this.isDocumentEdited()&&(!t.isReload||!this.backupMainService.isHotExitEnabled())&&this.setDocumentEdited(!1),t.isReload||(this.getRepresentedFilename()&&this.setRepresentedFilename(""),this._win.setTitle(this.productService.nameLong)),this.updateConfiguration(e,t),this.readyState===0?this._config=e:this.pendingLoadConfig=e,this.readyState=1;let n;process.env.VSCODE_DEV&&process.env.VSCODE_DEV_SERVER_URL?n=process.env.VSCODE_DEV_SERVER_URL:e.isSessionsWindow?n=et.asBrowserUri(`vs/sessions/electron-browser/sessions${this.environmentMainService.isBuilt?"":"-dev"}.html`).toString(!0):n=et.asBrowserUri(`vs/code/electron-browser/workbench/workbench${this.environmentMainService.isBuilt?"":"-dev"}.html`).toString(!0),this._win.loadURL(n);let i=this.wasLoaded;this.wasLoaded=!0,!this.environmentMainService.isBuilt&&!this.environmentMainService.extensionTestsLocationURI&&this._register(new pr(()=>{this._win&&!this._win.isVisible()&&!this._win.isMinimized()&&(this._win.show(),this.focus({mode:2}),this._win.webContents.openDevTools())},1e4)).schedule(),this._onWillLoad.fire({workspace:e.workspace,reason:t.isReload?3:i?2:1})}updateConfiguration(e,t){let n=(this._config??this.pendingLoadConfig)?.userEnv;if(n){let i=ei(n)&&!ei(e.userEnv),s=this.isExtensionDevelopmentHost;(i||s)&&(e.userEnv={...n,...e.userEnv})}process.env.CHROME_CRASHPAD_PIPE_NAME&&Object.assign(e.userEnv,{CHROME_CRASHPAD_PIPE_NAME:process.env.CHROME_CRASHPAD_PIPE_NAME}),t.disableExtensions!==void 0&&(e["disable-extensions"]=t.disableExtensions);try{e.handle=H.wrap(this._win.getNativeWindowHandle())}catch(i){this.logService.error(`Error getting native window handle: ${i}`)}e.fullscreen=this.isFullScreen,e.maximized=this._win.isMaximized(),e.partsSplash=this.themeMainService.getWindowSplash(e.workspace),e.zoomLevel=this.getZoomLevel(),e.isCustomZoomLevel=typeof this.customZoomLevel=="number",e.isCustomZoomLevel&&e.partsSplash&&(e.partsSplash.zoomLevel=e.zoomLevel),Ne("code/willOpenNewWindow"),e.perfMarks=Sp(),this.configObjectUrl.update(e)}async reload(e){let t=Object.assign({},this._config);t.workspace=await this.validateWorkspaceBeforeReload(t),delete t.filesToOpenOrCreate,delete t.filesToDiff,delete t.filesToMerge,delete t.filesToWait,this.isExtensionDevelopmentHost&&e&&(t.verbose=e.verbose,t.debugId=e.debugId,t.extensionEnvironment=e.extensionEnvironment,t["inspect-extensions"]=e["inspect-extensions"],t["inspect-brk-extensions"]=e["inspect-brk-extensions"],t["extensions-dir"]=e["extensions-dir"]),t.accessibilitySupport=un.app.isAccessibilitySupportEnabled(),t.isInitialStartup=!1,t.policiesData=this.policyService.serialize(),t.continueOn=this.environmentMainService.continueOn,t.profiles={all:this.userDataProfilesService.profiles,profile:this.profile||this.userDataProfilesService.defaultProfile,home:this.userDataProfilesService.profilesHome},t.logLevel=this.loggerMainService.getLogLevel(),t.loggers=this.loggerMainService.getGlobalLoggers(),this.load(t,{isReload:!0,disableExtensions:e?.["disable-extensions"]})}async validateWorkspaceBeforeReload(e){if(it(e.workspace)){let t=e.workspace.configPath;if(t.scheme===N.file&&!await this.fileService.exists(t))return}else if(Rt(e.workspace)){let t=e.workspace.uri;if(t.scheme===N.file&&!await this.fileService.exists(t))return}return e.workspace}serializeWindowState(){if(!this._win)return Si();if(this.isFullScreen){let n;try{n=un.screen.getDisplayMatching(this.getBounds())}catch{}let i=Si();return{mode:3,display:n?n.id:void 0,width:this.windowState.width||i.width,height:this.windowState.height||i.height,x:this.windowState.x||0,y:this.windowState.y||0,zoomLevel:this.customZoomLevel}}let e=Object.create(null),t;if(!V&&this._win.isMaximized()?t=0:t=1,t===0?e.mode=0:e.mode=1,t===1||t===0){let n;t===1?n=this.getBounds():n=this._win.getNormalBounds(),e.x=n.x,e.y=n.y,e.width=n.width,e.height=n.height}return e.zoomLevel=this.customZoomLevel,e}restoreWindowState(e){Ne("code/willRestoreCodeWindowState");let t=!1;if(e){this.customZoomLevel=e.zoomLevel;try{let n=un.screen.getAllDisplays();t=n.length>1,e=ml.validateWindowState(this.logService,e,n)}catch(n){this.logService.warn(`Unexpected error validating window state: ${n}
${n.stack}`)}}return Ne("code/didRestoreCodeWindowState"),[e||Si(),t]}getBounds(){let[e,t]=this._win.getPosition(),[n,i]=this._win.getSize();return{x:e,y:t,width:n,height:i}}setFullScreen(e,t){super.setFullScreen(e,t),this.sendWhenReady(e?"vscode:enterFullScreen":"vscode:leaveFullScreen",be.None),this.currentMenuBarVisibility&&this.setMenuBarVisibility(this.currentMenuBarVisibility,!1)}getMenuBarVisibility(){let e=Jx(this.configurationService);return["visible","toggle","hidden"].indexOf(e)<0&&(e="classic"),e}setMenuBarVisibility(e,t=!0){V||(e==="toggle"&&t&&this.send("vscode:showInfoMessage",h(2734,null)),e==="hidden"?setTimeout(()=>{this.doSetMenuBarVisibility(e)}):this.doSetMenuBarVisibility(e))}doSetMenuBarVisibility(e){let t=this.isFullScreen;switch(e){case"classic":this._win.setMenuBarVisibility(!t),this._win.autoHideMenuBar=t;break;case"visible":this._win.setMenuBarVisibility(!0),this._win.autoHideMenuBar=!1;break;case"toggle":this._win.setMenuBarVisibility(!1),this._win.autoHideMenuBar=!0;break;case"hidden":this._win.setMenuBarVisibility(!1),this._win.autoHideMenuBar=!1;break}}notifyZoomLevel(e){this.customZoomLevel=e}getZoomLevel(){return typeof this.customZoomLevel=="number"?this.customZoomLevel:this.configurationService.getValue("window")?.zoomLevel}close(){this._win?.close()}sendWhenReady(e,t,...n){this.isReady?this.send(e,...n):this.ready().then(()=>{t.isCancellationRequested||this.send(e,...n)})}send(e,...t){if(this._win){if(this._win.isDestroyed()||this._win.webContents.isDestroyed()){this.logService.warn(`Sending IPC message to channel '${e}' for window that is destroyed`);return}try{this._win.webContents.send(e,...t)}catch(n){this.logService.warn(`Error sending IPC message to channel '${e}' of window ${this._id}: ${Tr(n)}`)}}}updateTouchBar(e){V&&this.touchBarGroups.forEach((t,n)=>{let i=e[n];t.segments=this.createTouchBarGroupSegments(i)})}createTouchBar(){if(V){for(let e=0;e<10;e++){let t=this.createTouchBarGroup();this.touchBarGroups.push(t)}this._win.setTouchBar(new un.TouchBar({items:this.touchBarGroups}))}}createTouchBarGroup(e=[]){let t=this.createTouchBarGroupSegments(e),n=new un.TouchBar.TouchBarSegmentedControl({segments:t,mode:"buttons",segmentStyle:"automatic",change:i=>{this.sendWhenReady("vscode:runAction",be.None,{id:n.segments[i].id,from:"touchbar"})}});return n}createTouchBarGroupSegments(e=[]){return e.map(n=>{let i;n.icon&&!sc.isThemeIcon(n.icon)&&n.icon?.dark?.scheme===N.file&&(i=un.nativeImage.createFromPath(b.revive(n.icon.dark).fsPath),i.isEmpty()&&(i=void 0));let s;return typeof n.title=="string"?s=n.title:s=n.title.value,{id:n.id,label:i?void 0:s,icon:i}})}async startCollectingJScallStacks(){if(!this.jsCallStackCollector.isTriggered()){let e=await this._win?.webContents.mainFrame.collectJavaScriptCallStack();if(e){let t=this.jsCallStackMap.get(e)||0;this.jsCallStackMap.set(e,t+1)}this.jsCallStackCollector.trigger(()=>this.startCollectingJScallStacks())}}stopCollectingJScallStacks(){if(this.jsCallStackCollectorStopScheduler.cancel(),this.jsCallStackCollector.cancel(),this.jsCallStackMap.size){let e=`CodeWindow unresponsive samples:
`,t=0,n=Array.from(this.jsCallStackMap.entries()).sort((i,s)=>s[1]-i[1]);for(let[i,s]of n){if(t+=s,Math.round(s*100/this.jsCallStackEffectiveSampleCount)>20){let a=new EI(i,this.id,this._win?.webContents.getOSProcessId());xa.onUnexpectedError(a)}e+=`<${s}> ${i}
`}e+=`Total Samples: ${t}
`,e+="For full overview of the unresponsive period, capture cpu profile via https://aka.ms/vscode-tracing-cpu-profile",this.logService.error(e)}this.jsCallStackMap.clear()}matches(e){return this._win?.webContents.id===e.id}dispose(){super.dispose(),this.loggerMainService.deregisterLoggers(this.id)}};la=T([g(1,O),g(2,Wi),g(3,Te),g(4,An),g(5,Or),g(6,ke),g(7,zo),g(8,qs),g(9,ge),g(10,Pi),g(11,dn),g(12,Ci),g(13,ot),g(14,wn),g(15,me),g(16,_e),g(17,oc),g(18,Le),g(19,ft),g(20,Vt)],la);EI=class extends Error{constructor(r,e,t=0){let n=Error.stackTraceLimit;Error.stackTraceLimit=0,super(`UnresponsiveSampleError: from window with ID ${e} belonging to process with pid ${t}`),Error.stackTraceLimit=n,this.name="UnresponsiveSampleError",this.stack=r}}});import ac from"electron";function iA(o){let r={openedWindows:[]},e=o||{openedWindows:[]};return e.lastActiveWindow&&(r.lastActiveWindow=CI(e.lastActiveWindow)),e.lastPluginDevelopmentHostWindow&&(r.lastPluginDevelopmentHostWindow=CI(e.lastPluginDevelopmentHostWindow)),Array.isArray(e.openedWindows)&&(r.openedWindows=e.openedWindows.map(t=>CI(t))),r}function CI(o){let r={uiState:o.uiState};return o.backupPath&&(r.backupPath=o.backupPath),o.remoteAuthority&&(r.remoteAuthority=o.remoteAuthority),o.folder&&(r.folderUri=b.parse(o.folder)),o.workspaceIdentifier&&(r.workspace={id:o.workspaceIdentifier.id,configPath:b.parse(o.workspaceIdentifier.configURIPath)}),r}function oA(o){return{lastActiveWindow:o.lastActiveWindow&&_I(o.lastActiveWindow),lastPluginDevelopmentHostWindow:o.lastPluginDevelopmentHostWindow&&_I(o.lastPluginDevelopmentHostWindow),openedWindows:o.openedWindows.map(r=>_I(r))}}function _I(o){return{workspaceIdentifier:o.workspace&&{id:o.workspace.id,configURIPath:o.workspace.configPath.toString()},folder:o.folderUri?.toString(),backupPath:o.backupPath,remoteAuthority:o.remoteAuthority,uiState:o.uiState}}var mo,TT=w(()=>{K();Y();yt();se();st();xt();re();Jr();Wt();xi();hr();mo=class extends C{constructor(e,t,n,i,s){super();this.windowsMainService=e;this.stateService=t;this.lifecycleMainService=n;this.logService=i;this.configurationService=s;this.lastClosedState=void 0;this.shuttingDown=!1;this._state=iA(this.stateService.getItem(mo.windowsStateStorageKey)),this.registerListeners()}static{this.windowsStateStorageKey="windowsState"}get state(){return this._state}registerListeners(){ac.app.on("browser-window-blur",()=>{this.shuttingDown||this.saveWindowsState()}),this._register(this.lifecycleMainService.onBeforeCloseWindow(e=>this.onBeforeCloseWindow(e))),this._register(this.lifecycleMainService.onBeforeShutdown(()=>this.onBeforeShutdown())),this._register(this.windowsMainService.onDidChangeWindowsCount(e=>{e.newCount-e.oldCount>0&&(this.lastClosedState=void 0)})),this._register(this.windowsMainService.onDidDestroyWindow(e=>this.onBeforeCloseWindow(e)))}onBeforeShutdown(){this.shuttingDown=!0,this.saveWindowsState()}saveWindowsState(){let e=new Set,t={openedWindows:[],lastPluginDevelopmentHostWindow:this._state.lastPluginDevelopmentHostWindow,lastActiveWindow:this.lastClosedState};if(!t.lastActiveWindow){let s=this.windowsMainService.getLastActiveWindow();(!s||s.isExtensionDevelopmentHost)&&(s=this.windowsMainService.getWindows().find(a=>!a.isExtensionDevelopmentHost)),s&&(t.lastActiveWindow=this.toWindowState(s),t.lastActiveWindow.uiState.mode===3&&e.add(t.lastActiveWindow.uiState.display))}let n=this.windowsMainService.getWindows().find(s=>s.isExtensionDevelopmentHost&&!s.isExtensionTestHost);n&&(t.lastPluginDevelopmentHostWindow=this.toWindowState(n),t.lastPluginDevelopmentHostWindow.uiState.mode===3&&(e.has(t.lastPluginDevelopmentHostWindow.uiState.display)?V&&!n.win?.isSimpleFullScreen()&&(t.lastPluginDevelopmentHostWindow.uiState.mode=1):e.add(t.lastPluginDevelopmentHostWindow.uiState.display))),this.windowsMainService.getWindowCount()>1&&(t.openedWindows=this.windowsMainService.getWindows().filter(s=>!s.isExtensionDevelopmentHost).map(s=>{let a=this.toWindowState(s);return a.uiState.mode===3&&(e.has(a.uiState.display)?V&&a.windowId!==t.lastActiveWindow?.windowId&&!s.win?.isSimpleFullScreen()&&(a.uiState.mode=1):e.add(a.uiState.display)),a}));let i=oA(t);this.stateService.setItem(mo.windowsStateStorageKey,i),this.shuttingDown&&this.logService.trace("[WindowsStateHandler] onBeforeShutdown",i)}onBeforeCloseWindow(e){if(this.lifecycleMainService.quitRequested)return;let t=this.toWindowState(e);e.isExtensionDevelopmentHost&&!e.isExtensionTestHost?this._state.lastPluginDevelopmentHostWindow=t:!e.isExtensionDevelopmentHost&&e.openedWorkspace&&this._state.openedWindows.forEach(n=>{let i=it(e.openedWorkspace)&&n.workspace?.id===e.openedWorkspace.id,s=Rt(e.openedWorkspace)&&n.folderUri&&Ge.isEqual(n.folderUri,e.openedWorkspace.uri);(i||s)&&(n.uiState=t.uiState)}),this.windowsMainService.getWindowCount()===1&&(this.lastClosedState=t)}toWindowState(e){return{windowId:e.id,workspace:it(e.openedWorkspace)?e.openedWorkspace:void 0,folderUri:Rt(e.openedWorkspace)?e.openedWorkspace.uri:void 0,backupPath:e.backupPath,remoteAuthority:e.remoteAuthority,uiState:e.serializeWindowState()}}getNewWindowState(e){let t=this.doGetNewWindowState(e),n=this.configurationService.getValue("window");if(t.mode===3){let i;t.hasDefaultState?i=!!(n?.newWindowDimensions&&["fullscreen","inherit","offset"].indexOf(n.newWindowDimensions)>=0):i=!!(this.lifecycleMainService.wasRestarted||n?.restoreFullscreen),i||(t.mode=1)}return t}doGetNewWindowState(e){let t=this.windowsMainService.getLastActiveWindow();if(!e.extensionTestsPath){if(e.extensionDevelopmentPath&&this.state.lastPluginDevelopmentHostWindow)return this.state.lastPluginDevelopmentHostWindow.uiState;let c=e.workspace;if(it(c)){let u=this.state.openedWindows.filter(f=>f.workspace&&f.workspace.id===c.id).map(f=>f.uiState);if(u.length)return u[0]}if(Rt(c)){let u=this.state.openedWindows.filter(f=>f.folderUri&&Ge.isEqual(f.folderUri,c.uri)).map(f=>f.uiState);if(u.length)return u[0]}else if(e.backupPath){let u=this.state.openedWindows.filter(f=>f.backupPath===e.backupPath).map(f=>f.uiState);if(u.length)return u[0]}let d=this.lastClosedState||this.state.lastActiveWindow;if(!t&&d)return d.uiState}let n,i=ac.screen.getAllDisplays();if(i.length===1)n=i[0];else{if(V){let c=ac.screen.getCursorScreenPoint();n=ac.screen.getDisplayNearestPoint(c)}!n&&t&&(n=ac.screen.getDisplayMatching(t.getBounds())),n||(n=ac.screen.getPrimaryDisplay()||i[0])}let s=Si(void 0,it(e.workspace)||Rt(e.workspace));s.x=Math.round(n.bounds.x+n.bounds.width/2-s.width/2),s.y=Math.round(n.bounds.y+n.bounds.height/2-s.height/2);let a=this.configurationService.getValue("window"),l=!0;if(a?.newWindowDimensions){if(a.newWindowDimensions==="maximized")s.mode=0,l=!1;else if(a.newWindowDimensions==="fullscreen")s.mode=3,l=!1;else if((a.newWindowDimensions==="inherit"||a.newWindowDimensions==="offset")&&t){let c=t.serializeWindowState();c.mode===3?s.mode=3:s={...c,zoomLevel:void 0},l=s.mode!==3&&a.newWindowDimensions==="offset"}}return l&&(s=this.ensureNoOverlap(s)),s.hasDefaultState=!0,s}ensureNoOverlap(e){if(this.windowsMainService.getWindows().length===0)return e;e.x=typeof e.x=="number"?e.x:0,e.y=typeof e.y=="number"?e.y:0;let t=this.windowsMainService.getWindows().map(n=>n.getBounds());for(;t.some(n=>n.x===e.x||n.y===e.y);)e.x+=30,e.y+=30;return e}};mo=T([g(0,Le),g(1,ft),g(2,me),g(3,O),g(4,ge)],mo)});import{spawn as sA}from"child_process";var Bh,lc,kI=w(()=>{Se();ze();xs();qr();Z();re();Bh=W("ICSSDevelopmentService"),lc=class{constructor(r,e){this.envService=r;this.logService=e}get isEnabled(){return!this.envService.isBuilt}getCssModules(){return this._cssModules??=this.computeCssModules(),this._cssModules}async computeCssModules(){if(!this.isEnabled)return[];let r=await import("@vscode/ripgrep");return await new Promise(e=>{let t=sn.create(),n=[],i=et.asFileUri("").fsPath,s=sA(r.rgPath,["-g","**/*.css","--files","--no-ignore",i],{});s.stdout.on("data",a=>{n.push(a)}),s.on("error",a=>{this.logService.error("[CSS_DEV] FAILED to compute CSS data",a),e([])}),s.on("close",()=>{let a=Buffer.concat(n).toString("utf8"),l=a.split(`
`).filter(Boolean).map(c=>Op(i,c).replace(/\\/g,"/")).filter(Boolean).sort();l.some(c=>c.indexOf("vs/")!==0)&&this.logService.error(`[CSS_DEV] Detected invalid paths in css modules, raw output: ${a}`),e(l),this.logService.info(`[CSS_DEV] DONE, ${l.length} css modules (${Math.round(t.elapsed())}ms)`)})})}};lc=T([g(0,$r),g(1,O)],lc)});import*as CT from"fs";import{app as aA,BrowserWindow as Vh,shell as lA}from"electron";import{hostname as cA,release as dA,arch as uA}from"os";function Yu(o){return it(o?.workspace)}function cc(o){return Rt(o?.workspace)}var RI,dc,_T=w(()=>{Va();zt();St();Kn();Q();an();Ji();K();ze();Se();ai();Y();Bn();yt();We();se();Ce();Sl();st();js();Ot();je();Z();xt();re();Pd();Nh();Cl();Jr();no();TI();Wt();Dm();TT();hr();bm();qu();jo();xi();pl();ri();qo();Xl();Qs();kI();Lr();nt();RI=Object.create(null);dc=class extends C{constructor(e,t,n,i,s,a,l,c,d,u,f,m,y,v,S,I,k,R,D,F,ce,B){super();this.machineId=e;this.sqmId=t;this.devDeviceId=n;this.initialUserEnv=i;this.logService=s;this.loggerService=a;this.policyService=c;this.environmentMainService=d;this.userDataProfilesMainService=u;this.lifecycleMainService=f;this.backupMainService=m;this.configurationService=y;this.workspacesHistoryMainService=v;this.workspacesManagementMainService=S;this.instantiationService=I;this.dialogMainService=k;this.fileService=R;this.protocolMainService=D;this.themeMainService=F;this.auxiliaryWindowsMainService=ce;this.cssDevelopmentService=B;this._onDidOpenWindow=this._register(new x);this.onDidOpenWindow=this._onDidOpenWindow.event;this._onDidSignalReadyWindow=this._register(new x);this.onDidSignalReadyWindow=this._onDidSignalReadyWindow.event;this._onDidDestroyWindow=this._register(new x);this.onDidDestroyWindow=this._onDidDestroyWindow.event;this._onDidChangeWindowsCount=this._register(new x);this.onDidChangeWindowsCount=this._onDidChangeWindowsCount.event;this._onDidMaximizeWindow=this._register(new x);this.onDidMaximizeWindow=this._onDidMaximizeWindow.event;this._onDidUnmaximizeWindow=this._register(new x);this.onDidUnmaximizeWindow=this._onDidUnmaximizeWindow.event;this._onDidChangeFullScreen=this._register(new x);this.onDidChangeFullScreen=this._onDidChangeFullScreen.event;this._onDidTriggerSystemContextMenu=this._register(new x);this.onDidTriggerSystemContextMenu=this._onDidTriggerSystemContextMenu.event;this.windows=new Map;this.windowsStateHandler=this._register(new mo(this,l,this.lifecycleMainService,this.logService,this.configurationService)),this.registerListeners()}registerListeners(){this._register(this.workspacesManagementMainService.onDidEnterWorkspace(e=>this._onDidSignalReadyWindow.fire(e.window))),this._register(this.onDidSignalReadyWindow(e=>{if(e.config?.extensionDevelopmentPath||e.config?.extensionTestsPath){let t=new te;if(t.add(E.any(e.onDidClose,e.onDidDestroy)(()=>t.dispose())),e.config.extensionDevelopmentPath)for(let n of e.config.extensionDevelopmentPath)t.add(this.protocolMainService.addValidFileRoot(n));e.config.extensionTestsPath&&t.add(this.protocolMainService.addValidFileRoot(e.config.extensionTestsPath))}}))}openEmptyWindow(e,t){let n=this.environmentMainService.args,i=t?.remoteAuthority||void 0,s=!0,a=t?.forceReuseWindow,l=!a;return this.open({...e,cli:n,forceEmpty:s,forceNewWindow:l,forceReuseWindow:a,remoteAuthority:i,forceTempProfile:t?.forceTempProfile,forceProfile:t?.forceProfile})}openExistingWindow(e,t){e.focus(),this.handleWaitMarkerFile(t,[e])}async openSessionsWindow(e){this.logService.trace("windowsManager#openSessionsWindow");let t=this.environmentMainService.agentSessionsWorkspace;if(!t)throw new Error("Sessions workspace is not configured");if(!await this.fileService.exists(t)){let i=JSON.stringify({folders:[]},null,"	");await this.fileService.writeFile(t,H.fromString(i))}return this.open({...e,urisToOpen:[{workspaceUri:t}],cli:this.environmentMainService.args,forceNewWindow:!0,noRecentEntry:!0})}async open(e){this.logService.trace("windowsManager#open"),(e.addMode||e.removeMode)&&(e.initialStartup||!this.getLastActiveWindow())&&(e.addMode=!1,e.removeMode=!1);let t=[],n=[],i=[],s=[],a=[],l=[],c,d=!1,u=await this.getPathsToOpen(e);this.logService.trace("windowsManager#open pathsToOpen",u);for(let S of u)cc(S)?e.addMode?t.push(S):e.removeMode?n.push(S):i.push(S):Yu(S)?s.push(S):S.fileUri?(c||(c={filesToOpenOrCreate:[],filesToDiff:[],filesToMerge:[],remoteAuthority:S.remoteAuthority}),c.filesToOpenOrCreate.push(S)):S.backupPath?l.push({backupFolder:ye(S.backupPath),remoteAuthority:S.remoteAuthority}):d=!0;e.diffMode&&c&&c.filesToOpenOrCreate.length>=2&&(c.filesToDiff=c.filesToOpenOrCreate.slice(0,2),c.filesToOpenOrCreate=[]),e.mergeMode&&c&&c.filesToOpenOrCreate.length===4&&(c.filesToMerge=c.filesToOpenOrCreate.slice(0,4),c.filesToOpenOrCreate=[],c.filesToDiff=[]),c&&e.waitMarkerFileURI&&(c.filesToWait={paths:at([...c.filesToDiff,c.filesToMerge[3],...c.filesToOpenOrCreate]),waitMarkerFileUri:e.waitMarkerFileURI}),e.initialStartup?(a.push(...this.workspacesManagementMainService.getUntitledWorkspaces()),s.push(...a),l.push(...this.backupMainService.getEmptyWindowBackups())):l.length=0;let{windows:f,filesOpenedInWindow:m}=await this.doOpen(e,s,i,l,d,c,t,n);if(this.logService.trace(`windowsManager#open used window count ${f.length} (workspacesToOpen: ${s.length}, foldersToOpen: ${i.length}, emptyToRestore: ${l.length}, maybeOpenEmptyWindow: ${d})`),f.length>1)if(m)m.focus();else{let S=this.windowsStateHandler.state.lastActiveWindow&&!e.forceEmpty&&!e.cli._.length&&!e.cli["file-uri"]&&!e.cli["folder-uri"]&&!e.urisToOpen?.length,I=!0,k=!0;if(S){let R=f.filter(D=>this.windowsStateHandler.state.lastActiveWindow&&D.backupPath===this.windowsStateHandler.state.lastActiveWindow.backupPath);R.length&&(R[0].focus(),I=!1,k=!1)}if(I)for(let R=f.length-1;R>=0;R--){let D=f[R];if(!(D.openedWorkspace&&a.some(F=>D.openedWorkspace&&F.workspace.id===D.openedWorkspace.id)||D.backupPath&&l.some(F=>D.backupPath&&F.backupFolder===ye(D.backupPath)))){D.focus(),k=!1;break}}k&&f[f.length-1].focus()}let y=c&&c.filesToDiff.length>0,v=c&&c.filesToMerge.length>0;if(!f.some(S=>S.isExtensionDevelopmentHost)&&!y&&!v&&!e.noRecentEntry){let S=[];for(let I of u)Yu(I)&&!I.transient?S.push({label:I.label,workspace:I.workspace,remoteAuthority:I.remoteAuthority}):cc(I)?S.push({label:I.label,folderUri:I.workspace.uri,remoteAuthority:I.remoteAuthority}):I.fileUri&&S.push({label:I.label,fileUri:I.fileUri,remoteAuthority:I.remoteAuthority});this.workspacesHistoryMainService.addRecentlyOpened(S)}return this.handleWaitMarkerFile(e,f),f}handleWaitMarkerFile(e,t){let n=e.waitMarkerFileURI;e.context===0&&n&&t.length===1&&t[0]&&(async()=>{await t[0].whenClosedOrLoaded;try{await this.fileService.del(n)}catch{}})()}async doOpen(e,t,n,i,s,a,l,c){let d=[],u;function f(R,D){d.push(R),D&&(u=R,a=void 0)}let{openFolderInNewWindow:m,openFilesInNewWindow:y}=this.shouldOpenNewWindow(e);if(!e.initialStartup&&(l.length>0||c.length>0)){let R=l.at(0)?.remoteAuthority??c.at(0)?.remoteAuthority,D=this.getLastActiveWindowForAuthority(R);D&&f(this.doAddRemoveFoldersInExistingWindow(D,l.map(F=>F.workspace.uri),c.map(F=>F.workspace.uri)))}let v=n.length+t.length+i.length;if(a&&v===0){let R=a.filesToOpenOrCreate[0]||a.filesToDiff[0]||a.filesToMerge[3],D=this.getWindows().filter(ce=>a&&Ar(ce.remoteAuthority,a.remoteAuthority)),F;R?.fileUri&&!y&&((e.context===4||e.context===0||e.context===1||e.context===6)&&(F=await EP(D,R.fileUri,async ce=>ce.configPath.scheme===N.file?this.workspacesManagementMainService.resolveLocalWorkspace(ce.configPath):void 0)),F||(F=this.doGetLastActiveWindow(D))),F?it(F.openedWorkspace)?t.push({workspace:F.openedWorkspace,remoteAuthority:F.remoteAuthority}):Rt(F.openedWorkspace)?n.push({workspace:F.openedWorkspace,remoteAuthority:F.remoteAuthority}):f(this.doOpenFilesInExistingWindow(e,F,a),!0):f(await this.openInBrowserWindow({userEnv:e.userEnv,cli:e.cli,initialStartup:e.initialStartup,filesToOpen:a,forceNewWindow:!0,remoteAuthority:a.remoteAuthority,forceNewTabbedWindow:e.forceNewTabbedWindow,forceProfile:e.forceProfile,forceTempProfile:e.forceTempProfile}),!0)}let S=Wr(t,R=>R.workspace.id);if(S.length>0){let R=at(S.map(D=>_i(this.getWindows(),D.workspace.configPath)));if(R.length>0){let D=R[0],F=Ar(a?.remoteAuthority,D.remoteAuthority)?a:void 0;f(this.doOpenFilesInExistingWindow(e,D,F),!!F),m=!0}for(let D of S){if(R.some(B=>B.openedWorkspace&&B.openedWorkspace.id===D.workspace.id))continue;let F=D.remoteAuthority,ce=Ar(a?.remoteAuthority,F)?a:void 0;f(await this.doOpenFolderOrWorkspace(e,D,m,ce),!!ce),m=!0}}let I=Wr(n,R=>Ge.getComparisonKey(R.workspace.uri));if(I.length>0){let R=at(I.map(D=>_i(this.getWindows(),D.workspace.uri)));if(R.length>0){let D=R[0],F=Ar(a?.remoteAuthority,D.remoteAuthority)?a:void 0;f(this.doOpenFilesInExistingWindow(e,D,F),!!F),m=!0}for(let D of I){if(R.some(B=>Rt(B.openedWorkspace)&&Ge.isEqual(B.openedWorkspace.uri,D.workspace.uri)))continue;let F=D.remoteAuthority,ce=Ar(a?.remoteAuthority,F)?a:void 0;f(await this.doOpenFolderOrWorkspace(e,D,m,ce),!!ce),m=!0}}let k=Wr(i,R=>R.backupFolder);if(k.length>0)for(let R of k){let D=R.remoteAuthority,F=Ar(a?.remoteAuthority,D)?a:void 0;f(await this.doOpenEmpty(e,!0,D,F,R),!!F),m=!0}if(a||s&&(e.forceEmpty||d.length===0)){let R=a?a.remoteAuthority:e.remoteAuthority;f(await this.doOpenEmpty(e,m,R,a),!!a)}return{windows:Wr(d),filesOpenedInWindow:u}}doOpenFilesInExistingWindow(e,t,n){this.logService.trace("windowsManager#doOpenFilesInExistingWindow",{filesToOpen:n}),this.focusMainOrChildWindow(t);let i={filesToOpenOrCreate:n?.filesToOpenOrCreate,filesToDiff:n?.filesToDiff,filesToMerge:n?.filesToMerge,filesToWait:n?.filesToWait,termProgram:e?.userEnv?.TERM_PROGRAM};return t.sendWhenReady("vscode:openFiles",be.None,i),t}focusMainOrChildWindow(e){let t=e,n=Vh.getFocusedWindow();if(n&&n.id!==e.id){let i=this.auxiliaryWindowsMainService.getWindowByWebContents(n.webContents);i&&i.parentId===e.id&&(t=i)}t.focus()}doAddRemoveFoldersInExistingWindow(e,t,n){this.logService.trace("windowsManager#doAddRemoveFoldersToExistingWindow",{foldersToAdd:t,foldersToRemove:n}),e.focus();let i={foldersToAdd:t,foldersToRemove:n};return e.sendWhenReady("vscode:addRemoveFolders",be.None,i),e}doOpenEmpty(e,t,n,i,s){this.logService.trace("windowsManager#doOpenEmpty",{restore:!!s,remoteAuthority:n,filesToOpen:i,forceNewWindow:t});let a;return!t&&typeof e.contextWindowId=="number"&&(a=this.getWindowById(e.contextWindowId)),this.openInBrowserWindow({userEnv:e.userEnv,cli:e.cli,initialStartup:e.initialStartup,remoteAuthority:n,forceNewWindow:t,forceNewTabbedWindow:e.forceNewTabbedWindow,filesToOpen:i,windowToUse:a,emptyWindowBackupInfo:s,forceProfile:e.forceProfile,forceTempProfile:e.forceTempProfile})}doOpenFolderOrWorkspace(e,t,n,i,s){return this.logService.trace("windowsManager#doOpenFolderOrWorkspace",{folderOrWorkspace:t,filesToOpen:i}),!n&&!s&&typeof e.contextWindowId=="number"&&(s=this.getWindowById(e.contextWindowId)),this.openInBrowserWindow({workspace:t.workspace,userEnv:e.userEnv,cli:e.cli,initialStartup:e.initialStartup,remoteAuthority:t.remoteAuthority,forceNewWindow:n,forceNewTabbedWindow:e.forceNewTabbedWindow,filesToOpen:i,windowToUse:s,forceProfile:e.forceProfile,forceTempProfile:e.forceTempProfile})}async getPathsToOpen(e){let t,n=!1,i=!1;if(e.urisToOpen&&e.urisToOpen.length>0?(t=await this.doExtractPathsFromAPI(e),n=!0):e.forceEmpty?t=[RI]:e.cli._.length||e.cli["folder-uri"]||e.cli["file-uri"]?(t=await this.doExtractPathsFromCLI(e.cli),t.length===0&&t.push(RI),n=!0):(t=await this.doGetPathsFromLastSession(),t.length===0&&t.push(RI),i=!0),!e.addMode&&!e.removeMode&&n){let s=t.filter(a=>cc(a));if(s.length>1){let a=s[0].remoteAuthority;if(s.every(l=>Ar(l.remoteAuthority,a))){let l,c=await this.doGetWorkspaceMatchingFoldersFromLastSession(a,s);c?l=c:l=await this.workspacesManagementMainService.createUntitledWorkspace(s.map(d=>({uri:d.workspace.uri}))),t.push({workspace:l,remoteAuthority:a}),t=t.filter(d=>!cc(d))}}}if(e.initialStartup&&!i&&this.configurationService.getValue("window")?.restoreWindows==="preserve"){let s=await this.doGetPathsFromLastSession();t.unshift(...s.filter(a=>Yu(a)||cc(a)||a.backupPath))}return t}async doExtractPathsFromAPI(e){let t={gotoLineMode:e.gotoLineMode,remoteAuthority:e.remoteAuthority},n=await Promise.all(at(e.urisToOpen||[]).map(async i=>{let s=await this.resolveOpenable(i,t);if(s)return s.label=i.label,s;let a=this.resourceFromOpenable(i);this.dialogMainService.showMessageBox({type:"info",buttons:[h(2744,null)],message:a.scheme===N.file?h(2746,null):h(2748,null),detail:a.scheme===N.file?h(2745,null,ji(a,{os:Lt,tildify:this.environmentMainService})):h(2747,null,a.toString(!0))},Vh.getFocusedWindow()??void 0)}));return at(n)}async doExtractPathsFromCLI(e){let t=[],n={ignoreFileNotFound:!0,gotoLineMode:e.goto,remoteAuthority:e.remote||void 0,forceOpenWorkspaceAsFile:e.diff&&e._.length===2||e.merge&&e._.length===4},i=e["folder-uri"];if(i){let l=await Promise.all(i.map(c=>{let d=this.cliArgToUri(c);if(d)return this.resolveOpenable({folderUri:d},n)}));t.push(...at(l))}let s=e["file-uri"];if(s){let l=await Promise.all(s.map(c=>{let d=this.cliArgToUri(c);if(d)return this.resolveOpenable(bi(c)?{workspaceUri:d}:{fileUri:d},n)}));t.push(...at(l))}let a=await Promise.all(e._.map(l=>n.remoteAuthority?this.doResolveRemotePath(l,n):this.doResolveFilePath(l,n)));return t.push(...at(a)),t}cliArgToUri(e){try{let t=b.parse(e);if(!t.scheme){this.logService.error(`Invalid URI input string, scheme missing: ${e}`);return}return t.path?t:t.with({path:"/"})}catch(t){this.logService.error(`Invalid URI input string: ${e}, ${t.message}`)}}async doGetPathsFromLastSession(){let e=this.getRestoreWindowsSetting();switch(e){case"none":return[];case"one":case"all":case"preserve":case"folders":{let t=[];e!=="one"&&t.push(...this.windowsStateHandler.state.openedWindows),this.windowsStateHandler.state.lastActiveWindow&&t.push(this.windowsStateHandler.state.lastActiveWindow);let n=await Promise.all(t.map(async i=>{if(i.workspace){let s=await this.resolveOpenable({workspaceUri:i.workspace.configPath},{remoteAuthority:i.remoteAuthority,rejectTransientWorkspaces:!0});if(Yu(s))return s}else if(i.folderUri){let s=await this.resolveOpenable({folderUri:i.folderUri},{remoteAuthority:i.remoteAuthority});if(cc(s))return s}else if(e!=="folders"&&i.backupPath)return{backupPath:i.backupPath,remoteAuthority:i.remoteAuthority}}));return at(n)}}}getRestoreWindowsSetting(){let e;return this.lifecycleMainService.wasRestarted?e="all":(e=this.configurationService.getValue("window")?.restoreWindows||"all",["preserve","all","folders","one","none"].includes(e)||(e="all")),e}async doGetWorkspaceMatchingFoldersFromLastSession(e,t){let n=(await this.doGetPathsFromLastSession()).filter(s=>Yu(s)),i=t.map(s=>s.workspace.uri);for(let{workspace:s}of n){let a=await this.workspacesManagementMainService.resolveLocalWorkspace(s.configPath);if(!a||a.remoteAuthority!==e||a.transient||a.folders.length!==t.length)continue;let l=new Ea(i,c=>Ge.getComparisonKey(c));if(a.folders.every(c=>l.has(c.uri)))return a}}async resolveOpenable(e,t=Object.create(null)){let n=this.resourceFromOpenable(e);return n.scheme===N.file?(xy(e)&&(t={...t,forceOpenWorkspaceAsFile:!0}),this.doResolveFilePath(n.fsPath,t)):this.doResolveRemoteOpenable(e,t)}doResolveRemoteOpenable(e,t){let n=this.resourceFromOpenable(e),i=so(n)||t.remoteAuthority;if(n=Fa(rf(n)),xy(e)){if(t.gotoLineMode){let{path:s,line:a,column:l}=La(n.path);return{fileUri:n.with({path:s}),options:{selection:a?{startLineNumber:a,startColumn:l||1}:void 0},remoteAuthority:i}}return{fileUri:n,remoteAuthority:i}}else if(Ks(e))return{workspace:io(n),remoteAuthority:i};return{workspace:Im(n),remoteAuthority:i}}resourceFromOpenable(e){return Ks(e)?e.workspaceUri:dl(e)?e.folderUri:e.fileUri}async doResolveFilePath(e,t,n){let i,s;t.gotoLineMode&&({path:e,line:i,column:s}=La(e)),e=Zp(kt(e),mn());try{let a=await CT.promises.stat(e);if(a.isFile()){if(!t.forceOpenWorkspaceAsFile){let l=await this.workspacesManagementMainService.resolveLocalWorkspace(b.file(e));if(l)return l.transient&&t.rejectTransientWorkspaces?void 0:{workspace:{id:l.id,configPath:l.configPath},type:1,exists:!0,remoteAuthority:l.remoteAuthority,transient:l.transient}}return{fileUri:b.file(e),type:1,exists:!0,options:{selection:i?{startLineNumber:i,startColumn:s||1}:void 0}}}else{if(a.isDirectory())return{workspace:Im(b.file(e),a),type:2,exists:!0};if(!M&&e==="/dev/null")return{fileUri:b.file(e),type:1,exists:!0}}}catch(a){if(a.code==="ERR_UNC_HOST_NOT_ALLOWED"&&!n)return this.onUNCHostNotAllowed(e,t);let l=b.file(e);if(this.workspacesHistoryMainService.removeRecentlyOpened([l]),t.ignoreFileNotFound&&a.code==="ENOENT")return{fileUri:l,type:1,exists:!1};this.logService.error(`Invalid path provided: ${e}, ${a.message}`)}}async onUNCHostNotAllowed(e,t){let n=b.file(e),{response:i,checkboxChecked:s}=await this.dialogMainService.showMessageBox({type:"warning",buttons:[h(2738,null),h(2739,null),h(2743,null)],message:h(2741,null,n.authority),detail:h(2740,null,ji(n,{os:Lt,tildify:this.environmentMainService})),checkboxLabel:h(2742,null,n.authority),cancelId:1});if(i===0){if(zi(n.authority),s){let a={channel:"vscode:configureAllowedUNCHost",args:n.authority};this.sendToFocused(a.channel,a.args),this.sendToOpeningWindow(a.channel,a.args)}return this.doResolveFilePath(e,t,!0)}if(i===2)return lA.openExternal("https://aka.ms/vscode-windows-unc"),this.onUNCHostNotAllowed(e,t)}doResolveRemotePath(e,t){let n=e.charCodeAt(0),i=t.remoteAuthority,s,a;t.gotoLineMode&&({path:e,line:s,column:a}=La(e)),n!==47&&(Yp(n)&&e.charCodeAt(e.charCodeAt(1))===58&&(e=fi(e)),e=`/${e}`);let l=b.from({scheme:N.vscodeRemote,authority:i,path:e});if(e.charCodeAt(e.length-1)!==47){if(bi(e))return t.forceOpenWorkspaceAsFile?{fileUri:l,options:{selection:s?{startLineNumber:s,startColumn:a||1}:void 0},remoteAuthority:t.remoteAuthority}:{workspace:io(l),remoteAuthority:i};if(t.gotoLineMode||ue.basename(e).indexOf(".")!==-1)return{fileUri:l,options:{selection:s?{startLineNumber:s,startColumn:a||1}:void 0},remoteAuthority:i}}return{workspace:Im(l),remoteAuthority:i}}shouldOpenNewWindow(e){let t=this.configurationService.getValue("window"),n=t?.openFoldersInNewWindow||"default",i=t?.openFilesInNewWindow||"off",s=(e.preferNewWindow||e.forceNewWindow)&&!e.forceReuseWindow;!e.forceNewWindow&&!e.forceReuseWindow&&(n==="on"||n==="off")&&(s=n==="on");let a=!1;return e.forceNewWindow||e.forceReuseWindow?a=!!e.forceNewWindow&&!e.forceReuseWindow:(V?e.context===1&&(a=!0):e.context!==3&&e.context!==2&&!(e.userEnv&&e.userEnv.TERM_PROGRAM==="vscode")&&(a=!0),!e.cli.extensionDevelopmentPath&&(i==="on"||i==="off")&&(a=i==="on")),{openFolderInNewWindow:!!s,openFilesInNewWindow:a}}async openExtensionDevelopmentHostWindow(e,t){let n=TP(this.getWindows(),e);if(n)return this.lifecycleMainService.reload(n,t.cli),n.focus(),[n];let i=t.cli["folder-uri"]||[],s=t.cli["file-uri"]||[],a=t.cli._;if(!a.length&&!i.length&&!s.length&&!t.cli.extensionTestsPath){let d=this.windowsStateHandler.state.lastPluginDevelopmentHostWindow,u=d?.workspace??d?.folderUri;u&&(b.isUri(u)?u.scheme===N.file?a=[u.fsPath]:i=[u.toString()]:u.configPath.scheme===N.file?a=[ur(u.configPath)]:s=[u.configPath.toString()])}let l=t.remoteAuthority;for(let d of e)if(d.match(/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/)){let u=b.parse(d),f=so(u);f&&(l?Ar(f,l)||this.logService.error("more than one extension development path authority"):l=f)}a=a.filter(d=>{let u=b.file(d);return _i(this.getWindows(),u)?!1:Ar(so(u),l)}),i=i.filter(d=>{let u=this.cliArgToUri(d);return u&&_i(this.getWindows(),u)?!1:u?Ar(so(u),l):!1}),s=s.filter(d=>{let u=this.cliArgToUri(d);return u&&_i(this.getWindows(),u)?!1:u?Ar(so(u),l):!1}),t.cli._=a,t.cli["folder-uri"]=i,t.cli["file-uri"]=s;let c={context:t.context,cli:t.cli,forceNewWindow:!0,forceEmpty:!a.length&&!i.length&&!s.length,userEnv:t.userEnv,noRecentEntry:!0,waitMarkerFileURI:t.waitMarkerFileURI,remoteAuthority:l,forceProfile:t.forceProfile,forceTempProfile:t.forceTempProfile};return this.open(c)}async openInBrowserWindow(e){let t=this.configurationService.getValue("window"),n=this.getLastActiveWindow(),s=(t?.newWindowProfile?this.userDataProfilesMainService.profiles.find(c=>c.name===t.newWindowProfile):void 0)??n?.profile??this.userDataProfilesMainService.defaultProfile,a;!e.forceNewWindow&&!e.forceNewTabbedWindow&&(a=e.windowToUse||n,a&&a.focus());let l={...this.environmentMainService.args,...e.cli,machineId:this.machineId,sqmId:this.sqmId,devDeviceId:this.devDeviceId,isPortable:this.environmentMainService.isPortable,windowId:-1,mainPid:process.pid,appRoot:this.environmentMainService.appRoot,execPath:process.execPath,codeCachePath:this.environmentMainService.codeCachePath,backupPath:e.emptyWindowBackupInfo?U(this.environmentMainService.backupHome,e.emptyWindowBackupInfo.backupFolder):void 0,profiles:{home:this.userDataProfilesMainService.profilesHome,all:this.userDataProfilesMainService.profiles,profile:s},homeDir:this.environmentMainService.userHome.with({scheme:N.file}).fsPath,tmpDir:this.environmentMainService.tmpDir.with({scheme:N.file}).fsPath,userDataDir:this.environmentMainService.userDataPath,remoteAuthority:e.remoteAuthority,workspace:e.workspace,userEnv:{...this.initialUserEnv,...e.userEnv},nls:{messages:zg(),language:ed()},filesToOpenOrCreate:e.filesToOpen?.filesToOpenOrCreate,filesToDiff:e.filesToOpen?.filesToDiff,filesToMerge:e.filesToOpen?.filesToMerge,filesToWait:e.filesToOpen?.filesToWait,logLevel:this.loggerService.getLogLevel(),loggers:this.loggerService.getGlobalLoggers(),logsPath:this.environmentMainService.logsHome.with({scheme:N.file}).fsPath,product:Er,isInitialStartup:e.initialStartup,perfMarks:Sp(),os:{release:dA(),hostname:cA(),arch:uA()},autoDetectHighContrast:t?.autoDetectHighContrast??!0,autoDetectColorScheme:t?.autoDetectColorScheme??!1,accessibilitySupport:aA.accessibilitySupportEnabled,colorScheme:this.themeMainService.getColorScheme(),policiesData:this.policyService.serialize(),continueOn:this.environmentMainService.continueOn,cssModules:this.cssDevelopmentService.isEnabled?await this.cssDevelopmentService.getCssModules():void 0,isSessionsWindow:it(e.workspace)&&md(e.workspace.configPath,this.environmentMainService.agentSessionsWorkspace)};if(a){let c=a.config;!l.extensionDevelopmentPath&&c?.extensionDevelopmentPath&&(l.extensionDevelopmentPath=c.extensionDevelopmentPath,l.extensionDevelopmentKind=c.extensionDevelopmentKind,l["enable-proposed-api"]=c["enable-proposed-api"],l.verbose=c.verbose,l["inspect-extensions"]=c["inspect-extensions"],l["inspect-brk-extensions"]=c["inspect-brk-extensions"],l.debugId=c.debugId,l.extensionEnvironment=c.extensionEnvironment,l["extensions-dir"]=c["extensions-dir"],l["disable-extensions"]=c["disable-extensions"],l["disable-extension"]=c["disable-extension"])}else{let c=this.windowsStateHandler.getNewWindowState(l);Ne("code/willCreateCodeWindow");let d=a=this.instantiationService.createInstance(la,{state:c,extensionDevelopmentPath:l.extensionDevelopmentPath,isExtensionTestHost:!!l.extensionTestsPath});Ne("code/didCreateCodeWindow"),e.forceNewTabbedWindow&&this.getLastActiveWindow()?.addTabbedWindow(d),this.windows.set(d.id,d),this._onDidOpenWindow.fire(d),this._onDidChangeWindowsCount.fire({oldCount:this.getWindowCount()-1,newCount:this.getWindowCount()});let u=new te;u.add(d.onDidSignalReady(()=>this._onDidSignalReadyWindow.fire(d))),u.add(E.once(d.onDidClose)(()=>this.onWindowClosed(d,u))),u.add(E.once(d.onDidDestroy)(()=>this.onWindowDestroyed(d))),u.add(d.onDidMaximize(()=>this._onDidMaximizeWindow.fire(d))),u.add(d.onDidUnmaximize(()=>this._onDidUnmaximizeWindow.fire(d))),u.add(d.onDidEnterFullScreen(()=>this._onDidChangeFullScreen.fire({window:d,fullscreen:!0}))),u.add(d.onDidLeaveFullScreen(()=>this._onDidChangeFullScreen.fire({window:d,fullscreen:!1}))),u.add(d.onDidTriggerSystemContextMenu(({x:m,y})=>this._onDidTriggerSystemContextMenu.fire({window:d,x:m,y})));let f=ui(d.win?.webContents);f.removeAllListeners("devtools-reload-page"),u.add(E.fromNodeEventEmitter(f,"devtools-reload-page")(()=>this.lifecycleMainService.reload(d))),this.lifecycleMainService.registerWindow(d)}return l.windowId=a.id,a.isReady?this.lifecycleMainService.unload(a,4).then(async c=>{c||await this.doOpenInBrowserWindow(a,l,e,s)}):await this.doOpenInBrowserWindow(a,l,e,s),a}async doOpenInBrowserWindow(e,t,n,i){t.extensionDevelopmentPath||(it(t.workspace)?t.backupPath=this.backupMainService.registerWorkspaceBackup({workspace:t.workspace,remoteAuthority:t.remoteAuthority}):Rt(t.workspace)?t.backupPath=this.backupMainService.registerFolderBackup({folderUri:t.workspace.uri,remoteAuthority:t.remoteAuthority}):t.backupPath=this.backupMainService.registerEmptyWindowBackup({backupFolder:n.emptyWindowBackupInfo?.backupFolder??vu().id,remoteAuthority:t.remoteAuthority}));let s=t.workspace??No(t.backupPath,!1),a=this.resolveProfileForBrowserWindow(n,s,i),l=a instanceof Promise?await a:a;t.profiles.profile=l,t.extensionDevelopmentPath||await this.userDataProfilesMainService.setProfileForWorkspace(s,l),e.load(t)}resolveProfileForBrowserWindow(e,t,n){return e.forceProfile?this.userDataProfilesMainService.profiles.find(i=>i.name===e.forceProfile)??this.userDataProfilesMainService.createNamedProfile(e.forceProfile):e.forceTempProfile?this.userDataProfilesMainService.createTransientProfile():this.userDataProfilesMainService.getProfileForWorkspace(t)??n}onWindowClosed(e,t){this.windows.delete(e.id),this._onDidChangeWindowsCount.fire({oldCount:this.getWindowCount()+1,newCount:this.getWindowCount()}),t.dispose()}onWindowDestroyed(e){this.windows.delete(e.id),this._onDidDestroyWindow.fire(e)}getFocusedWindow(){let e=Vh.getFocusedWindow();if(e)return this.getWindowById(e.id)}getLastActiveWindow(){return this.doGetLastActiveWindow(this.getWindows())}getLastActiveWindowForAuthority(e){return this.doGetLastActiveWindow(this.getWindows().filter(t=>Ar(t.remoteAuthority,e)))}doGetLastActiveWindow(e){return dm(e)}sendToFocused(e,...t){(this.getFocusedWindow()||this.getLastActiveWindow())?.sendWhenReady(e,be.None,...t)}sendToOpeningWindow(e,...t){this._register(E.once(this.onDidSignalReadyWindow)(n=>{n.sendWhenReady(e,be.None,...t)}))}sendToAll(e,t,n){for(let i of this.getWindows())n&&n.indexOf(i.id)>=0||i.sendWhenReady(e,be.None,t)}getWindows(){return Array.from(this.windows.values())}getWindowCount(){return this.windows.size}getWindowById(e){return this.windows.get(e)}getWindowByWebContents(e){let t=Vh.fromWebContents(e);if(!t)return;let n=this.getWindowById(t.id);return n?.matches(e)?n:void 0}};dc=T([g(4,O),g(5,Wi),g(6,ft),g(7,An),g(8,Te),g(9,Or),g(10,me),g(11,Ci),g(12,ge),g(13,ss),g(14,dn),g(15,Vt),g(16,wn),g(17,ke),g(18,oc),g(19,Pi),g(20,In),g(21,Bh)],dc)});var Hh,kT=w(()=>{he();Q();K();Hh=class extends C{constructor({onDidOpenMainWindow:e,onDidFocusMainWindow:t,getActiveWindowId:n}){super();this.disposables=this._register(new te);E.latch(E.any(e,t))(this.setActiveWindow,this,this.disposables),this.firstActiveWindowIdPromise=zn(()=>n()),(async()=>{try{let s=await this.firstActiveWindowIdPromise;this.activeWindowId=typeof this.activeWindowId=="number"?this.activeWindowId:s}catch{}finally{this.firstActiveWindowIdPromise=void 0}})()}setActiveWindow(e){this.firstActiveWindowIdPromise&&(this.firstActiveWindowIdPromise.cancel(),this.firstActiveWindowIdPromise=void 0),this.activeWindowId=e}async getActiveClientId(){return`window:${this.firstActiveWindowIdPromise?await this.firstActiveWindowIdPromise:this.activeWindowId}`}}});var uc,RT=w(()=>{Sl();Wt();qu();jo();uc=class{constructor(r,e,t,n){this.workspacesManagementMainService=r;this.windowsMainService=e;this.workspacesHistoryMainService=t;this.backupMainService=n;this.onDidChangeRecentlyOpened=this.workspacesHistoryMainService.onDidChangeRecentlyOpened}async enterWorkspace(r,e){let t=this.windowsMainService.getWindowById(r);if(t)return this.workspacesManagementMainService.enterWorkspace(t,this.windowsMainService.getWindows(),e)}createUntitledWorkspace(r,e,t){return this.workspacesManagementMainService.createUntitledWorkspace(e,t)}deleteUntitledWorkspace(r,e){return this.workspacesManagementMainService.deleteUntitledWorkspace(e)}getWorkspaceIdentifier(r,e){return this.workspacesManagementMainService.getWorkspaceIdentifier(e)}getRecentlyOpened(r){return this.workspacesHistoryMainService.getRecentlyOpened()}addRecentlyOpened(r,e){return this.workspacesHistoryMainService.addRecentlyOpened(e)}removeRecentlyOpened(r,e){return this.workspacesHistoryMainService.removeRecentlyOpened(e)}clearRecentlyOpened(r){return this.workspacesHistoryMainService.clearRecentlyOpened()}async getDirtyWorkspaces(){return this.backupMainService.getDirtyWorkspaces()}};uc=T([g(0,dn),g(1,Le),g(2,ss),g(3,Ci)],uc)});var Kh,DT=w(()=>{Q();K();ri();Kh=class{constructor(r){this.service=r;this.disposables=new te}listen(r,e){if(e==="onDidChange")return E.map(this.service.onDidChange,t=>t.reduce((n,i)=>({...n,[i]:this.service.getPolicyValue(i)??null}),{}),this.disposables);throw new Error(`Event not found: ${e}`)}call(r,e,t){if(e==="updatePolicyDefinitions")return this.service.updatePolicyDefinitions(t);throw new Error(`Call not found: ${e}`)}dispose(){this.disposables.dispose()}}});function AT(o){return o.map(r=>{let[e,t]=r.split("@");return{proposalName:e,version:t?parseInt(t):void 0}})}function MT(o){return o.map(r=>r.split("@")[0])}var WT,LT,qh,ho,$h,Ade,Zu=w(()=>{dr();Z();Cl();WT="extensions.user.cache",LT="extensions.builtin.cache",qh="undefined_publisher",ho=class{constructor(r){this.value=r,this._lower=r.toLowerCase()}static equals(r,e){if(typeof r>"u"||r===null)return typeof e>"u"||e===null;if(typeof e>"u"||e===null)return!1;if(typeof r=="string"||typeof e=="string"){let t=typeof r=="string"?r:r.value,n=typeof e=="string"?e:e.value;return Hr(t,n)}return r._lower===e._lower}static toKey(r){return typeof r=="string"?r.toLowerCase():r._lower}},$h=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(r){this._map.delete(ho.toKey(r))}get(r){return this._map.get(ho.toKey(r))}has(r){return this._map.has(ho.toKey(r))}set(r,e){this._map.set(ho.toKey(r),e)}values(){return this._map.values()}forEach(r){this._map.forEach(r)}[Symbol.iterator](){return this._map[Symbol.iterator]()}};Ade=W("IBuiltinExtensionsScannerService")});function FT(o,r){switch(o){case 3:return r==="x64"?"win32-x64":r==="arm64"?"win32-arm64":"unknown";case 2:return r==="x64"?"linux-x64":r==="arm64"?"linux-arm64":r==="arm"?"linux-armhf":"unknown";case"alpine":return r==="x64"?"alpine-x64":r==="arm64"?"alpine-arm64":"unknown";case 1:return r==="x64"?"darwin-x64":r==="arm64"?"darwin-arm64":"unknown";case 0:return"web"}}function UT(o){let r=o;return!!r&&typeof r=="object"&&typeof r.id=="string"&&(!r.uuid||typeof r.uuid=="string")}var pA,Xde,Yde,Zde,eue,tue,rue,nue,iue,fA,zh=w(()=>{Y();Sd();Ce();Gi();Zu();je();Z();jn();pA="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",Xde=new RegExp(pA);Yde=W("extensionGalleryService"),Zde=W("extensionManagementService"),eue=W("IGlobalExtensionEnablementService"),tue=W("IExtensionTipsService"),rue=W("IAllowedExtensionsService"),nue=Gg(1972,"Extensions"),iue=Gg(1989,"Preferences"),fA="extensions.allowed";Tt.as(tr.Configuration).registerConfiguration({id:"extensions",order:30,title:h(1988,null),type:"object",properties:{[fA]:{type:"object",markdownDescription:h(1978,null),default:"*",defaultSnippets:[{body:{},description:h(1983,null)},{body:{"*":!0},description:h(1979,null)}],scope:1,policy:{name:"AllowedExtensions",category:"Extensions",minimumVersion:"1.96",localization:{description:{key:"extensions.allowed.policy",value:h(1984,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:h(1976,null),enumDescriptions:[h(1982,null),h(1980,null),h(1981,null)]},{type:"array",items:{type:"string"},description:h(1977,null)}]},"([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:["boolean","string"],enum:[!0,!1,"stable"],description:h(1971,null),enumDescriptions:[h(1987,null),h(1985,null),h(1986,null)]},"\\*":{type:"boolean",enum:[!0,!1],description:h(1973,null),enumDescriptions:[h(1975,null),h(1974,null)]}}}}})});function ca(o,r){return o.uuid&&r.uuid?o.uuid===r.uuid:o.id===r.id?!0:pd(o.id,r.id)===0}function NT(o,r){return`${o}.${r}`}function mA(o){return o.toLowerCase()}function BT(o,r){return mA(NT(o??qh,r))}async function hA(o,r){if(!ne)return!1;let e;try{e=(await o.readFile(b.file("/etc/os-release"))).value.toString()}catch{try{e=(await o.readFile(b.file("/usr/lib/os-release"))).value.toString()}catch(n){r.debug("Error while getting the os-release file.",qt(n))}}return!!e&&(e.match(/^ID=([^\u001b\r\n]*)/m)||[])[1]==="alpine"}async function VT(o,r){let e=await hA(o,r),t=FT(e?"alpine":Ni,tS);return r.debug("ComputeTargetPlatform:",t),t}var Iue,DI=w(()=>{dr();zh();Zu();Y();se();Ve();Bn();cs();We();Iue=new ho("pprice.better-merge")});function HT(o){let r=o;return Je(r)&&UT(r.identifier)&&(gA(r.location)||Ae(r.location)&&!!r.location)&&(En(r.relativeLocation)||Ae(r.relativeLocation))&&!!r.version&&Ae(r.version)}function gA(o){if(!o)return!1;let r=o;return typeof r?.path=="string"&&typeof r?.scheme=="string"}var da,ps,pc,ep=w(()=>{he();nt();K();Q();Lr();se();zh();DI();je();Z();re();Yn();Xn();We();Ve();da=class extends Error{constructor(e,t){super(e);this.code=t}},ps=W("IExtensionsProfileScannerService"),pc=class extends C{constructor(e,t,n,i,s){super();this.extensionsLocation=e;this.fileService=t;this.userDataProfilesService=n;this.uriIdentityService=i;this.logService=s;this._onAddExtensions=this._register(new x);this.onAddExtensions=this._onAddExtensions.event;this._onDidAddExtensions=this._register(new x);this.onDidAddExtensions=this._onDidAddExtensions.event;this._onRemoveExtensions=this._register(new x);this.onRemoveExtensions=this._onRemoveExtensions.event;this._onDidRemoveExtensions=this._register(new x);this.onDidRemoveExtensions=this._onDidRemoveExtensions.event;this.resourcesAccessQueueMap=new gt}scanProfileExtensions(e,t){return this.withProfileExtensions(e,void 0,t)}async addExtensionsToProfile(e,t,n){let i=[],s=[];try{return await this.withProfileExtensions(t,a=>{let l=[];if(n)l.push(...a);else for(let c of a)e.some(([d])=>ca(d.identifier,c.identifier)&&d.manifest.version!==c.version)?i.push(c):l.push(c);for(let[c,d]of e){let u=l.findIndex(m=>ca(m.identifier,c.identifier)&&m.version===c.manifest.version),f={identifier:c.identifier,version:c.manifest.version,location:c.location,metadata:d};u===-1?(s.push(f),l.push(f)):l.splice(u,1,f)}return s.length&&this._onAddExtensions.fire({extensions:s,profileLocation:t}),i.length&&this._onRemoveExtensions.fire({extensions:i,profileLocation:t}),l}),s.length&&this._onDidAddExtensions.fire({extensions:s,profileLocation:t}),i.length&&this._onDidRemoveExtensions.fire({extensions:i,profileLocation:t}),s}catch(a){throw s.length&&this._onDidAddExtensions.fire({extensions:s,error:a,profileLocation:t}),i.length&&this._onDidRemoveExtensions.fire({extensions:i,error:a,profileLocation:t}),a}}async updateMetadata(e,t){let n=[];return await this.withProfileExtensions(t,i=>{let s=[];for(let a of i){let l=e.find(([c])=>ca({id:c.identifier.id},{id:a.identifier.id})&&c.manifest.version===a.version);l&&(a.metadata={...a.metadata,...l[1]},n.push(a)),s.push(a)}return s}),n}async removeExtensionsFromProfile(e,t){let n=[];try{await this.withProfileExtensions(t,i=>{let s=[];for(let a of i)e.some(l=>ca(a.identifier,l))?n.push(a):s.push(a);return n.length&&this._onRemoveExtensions.fire({extensions:n,profileLocation:t}),s}),n.length&&this._onDidRemoveExtensions.fire({extensions:n,profileLocation:t})}catch(i){throw n.length&&this._onDidRemoveExtensions.fire({extensions:n,error:i,profileLocation:t}),i}}async withProfileExtensions(e,t,n){return this.getResourceAccessQueue(e).queue(async()=>{let i=[],s;try{let a=await this.fileService.readFile(e);s=JSON.parse(a.value.toString().trim()||"[]")}catch(a){if(jr(a)!==1)throw a;if(this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)&&(s=await this.migrateFromOldDefaultProfileExtensionsLocation()),!s&&n?.bailOutWhenFileNotFound)throw new da(qt(a),"ERROR_PROFILE_NOT_FOUND")}if(s){Array.isArray(s)||this.throwInvalidConentError(e);let a=!1;for(let l of s){HT(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=b.revive(l.location);let u=this.toRelativePath(c);u&&(a=!0,l.relativeLocation=u)}En(l.metadata?.hasPreReleaseVersion)&&l.metadata?.preRelease&&(a=!0,l.metadata.hasPreReleaseVersion=!0);let d=l.metadata?.id??l.identifier.uuid;i.push({identifier:d?{id:l.identifier.id,uuid:d}:{id:l.identifier.id},location:c,version:l.version,metadata:l.metadata})}a&&await this.fileService.writeFile(e,H.fromString(JSON.stringify(s)))}if(t){i=t(i);let a=i.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,H.fromString(JSON.stringify(a)))}return i})}throwInvalidConentError(e){throw new da(`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"),n;try{n=(await this.fileService.readFile(e)).value.toString()}catch(s){if(jr(s)===1)return;throw s}this.logService.info("Migrating extensions from old default profile location",e.toString());let i;try{let s=JSON.parse(n);Array.isArray(s)&&s.every(a=>HT(a))?i=s:this.logService.warn("Skipping migrating from old default profile locaiton: Found invalid data",s)}catch(s){this.logService.error(s)}if(i)try{await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource,H.fromString(JSON.stringify(i)),{overwrite:!1}),this.logService.info("Migrated extensions from old default profile location to new location",e.toString(),this.userDataProfilesService.defaultProfile.extensionsResource.toString())}catch(s){if(jr(s)===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 s}try{await this.fileService.del(e)}catch(s){jr(s)!==1&&this.logService.error(s)}try{await this.fileService.del(t)}catch(s){jr(s)!==1&&this.logService.error(s)}return i})()),this._migrationPromise}getResourceAccessQueue(e){let t=this.resourcesAccessQueueMap.get(e);return t||(t=new Cn,this.resourcesAccessQueueMap.set(e,t)),t}};pc=T([g(1,ke),g(2,_r),g(3,Dt),g(4,O)],pc)});function Gh(o){switch(o){case 1:return h(126,null);case 2:return h(125,null);case 3:return h(127,null);case 4:return h(128,null);case 5:return h(122,null);case 6:return h(123,null);case 7:return h(120,null);case 8:return h(121,null);case 9:return h(124,null);default:return""}}var KT=w(()=>{Ce();Zn()});var jh,Fe,Gue,jue,$T,Jue,Que,Xue,Yue,Zue,epe,tpe,qT,rpe,npe,ipe,zT,ope,spe,ape,lpe,cpe,dpe,upe,ppe,fpe,mpe,hpe,gpe,vpe,ype,wpe,Ipe,bpe,Spe,xpe,Ppe,Epe,Tpe,WI=w(()=>{jh={},Fe={exports:jh};(function(o,r){if(typeof jh=="object"&&typeof Fe=="object")Fe.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e=r();for(var t in e)(typeof jh=="object"?jh:o)[t]=e[t]}})(typeof self<"u"?self:void 0,(function(){return(function(o){var r={};function e(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return o[t].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=o,e.c=r,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},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,n){if(1&n&&(t=e(t)),8&n||4&n&&typeof t=="object"&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&typeof t!="string")for(var s in t)e.d(i,s,function(a){return t[a]}.bind(null,s));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)})([function(o,r,e){(function(t){var n;r=o.exports=Ye,n=typeof t=="object"&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?function(){var P=Array.prototype.slice.call(arguments,0);P.unshift("SEMVER"),console.log.apply(console,P)}:function(){},r.SEMVER_SPEC_VERSION="2.0.0";var i=256,s=Number.MAX_SAFE_INTEGER||9007199254740991,a=r.re=[],l=r.src=[],c=0,d=c++;l[d]="0|[1-9]\\d*";var u=c++;l[u]="[0-9]+";var f=c++;l[f]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var m=c++;l[m]="("+l[d]+")\\.("+l[d]+")\\.("+l[d]+")";var y=c++;l[y]="("+l[u]+")\\.("+l[u]+")\\.("+l[u]+")";var v=c++;l[v]="(?:"+l[d]+"|"+l[f]+")";var S=c++;l[S]="(?:"+l[u]+"|"+l[f]+")";var I=c++;l[I]="(?:-("+l[v]+"(?:\\."+l[v]+")*))";var k=c++;l[k]="(?:-?("+l[S]+"(?:\\."+l[S]+")*))";var R=c++;l[R]="[0-9A-Za-z-]+";var D=c++;l[D]="(?:\\+("+l[R]+"(?:\\."+l[R]+")*))";var F=c++,ce="v?"+l[m]+l[I]+"?"+l[D]+"?";l[F]="^"+ce+"$";var B="[v=\\s]*"+l[y]+l[k]+"?"+l[D]+"?",ee=c++;l[ee]="^"+B+"$";var z=c++;l[z]="((?:<|>)?=?)";var Pe=c++;l[Pe]=l[u]+"|x|X|\\*";var Pt=c++;l[Pt]=l[d]+"|x|X|\\*";var Ft=c++;l[Ft]="[v=\\s]*("+l[Pt]+")(?:\\.("+l[Pt]+")(?:\\.("+l[Pt]+")(?:"+l[I]+")?"+l[D]+"?)?)?";var Ur=c++;l[Ur]="[v=\\s]*("+l[Pe]+")(?:\\.("+l[Pe]+")(?:\\.("+l[Pe]+")(?:"+l[k]+")?"+l[D]+"?)?)?";var Nr=c++;l[Nr]="^"+l[z]+"\\s*"+l[Ft]+"$";var X=c++;l[X]="^"+l[z]+"\\s*"+l[Ur]+"$";var $=c++;l[$]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var J=c++;l[J]="(?:~>?)";var G=c++;l[G]="(\\s*)"+l[J]+"\\s+",a[G]=new RegExp(l[G],"g");var ie=c++;l[ie]="^"+l[J]+l[Ft]+"$";var ve=c++;l[ve]="^"+l[J]+l[Ur]+"$";var Re=c++;l[Re]="(?:\\^)";var dt=c++;l[dt]="(\\s*)"+l[Re]+"\\s+",a[dt]=new RegExp(l[dt],"g");var tt=c++;l[tt]="^"+l[Re]+l[Ft]+"$";var Zt=c++;l[Zt]="^"+l[Re]+l[Ur]+"$";var sr=c++;l[sr]="^"+l[z]+"\\s*("+B+")$|^$";var Br=c++;l[Br]="^"+l[z]+"\\s*("+ce+")$|^$";var Be=c++;l[Be]="(\\s*)"+l[z]+"\\s*("+B+"|"+l[Ft]+")",a[Be]=new RegExp(l[Be],"g");var oi=c++;l[oi]="^\\s*("+l[Ft]+")\\s+-\\s+("+l[Ft]+")\\s*$";var Gc=c++;l[Gc]="^\\s*("+l[Ur]+")\\s+-\\s+("+l[Ur]+")\\s*$";var jc=c++;l[jc]="(<|>)?=?\\s*\\*";for(var pe=0;pe<35;pe++)n(pe,l[pe]),a[pe]||(a[pe]=new RegExp(l[pe]));function vs(P,L){if(P instanceof Ye)return P;if(typeof P!="string"||P.length>i||!(L?a[ee]:a[F]).test(P))return null;try{return new Ye(P,L)}catch{return null}}function Ye(P,L){if(P instanceof Ye){if(P.loose===L)return P;P=P.version}else if(typeof P!="string")throw new TypeError("Invalid Version: "+P);if(P.length>i)throw new TypeError("version is longer than "+i+" characters");if(!(this instanceof Ye))return new Ye(P,L);n("SemVer",P,L),this.loose=L;var A=P.trim().match(L?a[ee]:a[F]);if(!A)throw new TypeError("Invalid Version: "+P);if(this.raw=P,this.major=+A[1],this.minor=+A[2],this.patch=+A[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");A[4]?this.prerelease=A[4].split(".").map((function(le){if(/^[0-9]+$/.test(le)){var Ie=+le;if(Ie>=0&&Ie<s)return Ie}return le})):this.prerelease=[],this.build=A[5]?A[5].split("."):[],this.format()}r.parse=vs,r.valid=function(P,L){var A=vs(P,L);return A?A.version:null},r.clean=function(P,L){var A=vs(P.trim().replace(/^[=v]+/,""),L);return A?A.version:null},r.SemVer=Ye,Ye.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},Ye.prototype.toString=function(){return this.version},Ye.prototype.compare=function(P){return n("SemVer.compare",this.version,this.loose,P),P instanceof Ye||(P=new Ye(P,this.loose)),this.compareMain(P)||this.comparePre(P)},Ye.prototype.compareMain=function(P){return P instanceof Ye||(P=new Ye(P,this.loose)),ya(this.major,P.major)||ya(this.minor,P.minor)||ya(this.patch,P.patch)},Ye.prototype.comparePre=function(P){if(P instanceof Ye||(P=new Ye(P,this.loose)),this.prerelease.length&&!P.prerelease.length)return-1;if(!this.prerelease.length&&P.prerelease.length)return 1;if(!this.prerelease.length&&!P.prerelease.length)return 0;var L=0;do{var A=this.prerelease[L],le=P.prerelease[L];if(n("prerelease compare",L,A,le),A===void 0&&le===void 0)return 0;if(le===void 0)return 1;if(A===void 0)return-1;if(A!==le)return ya(A,le)}while(++L)},Ye.prototype.inc=function(P,L){switch(P){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",L);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",L);break;case"prepatch":this.prerelease.length=0,this.inc("patch",L),this.inc("pre",L);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",L),this.inc("pre",L);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 A=this.prerelease.length;--A>=0;)typeof this.prerelease[A]=="number"&&(this.prerelease[A]++,A=-2);A===-1&&this.prerelease.push(0)}L&&(this.prerelease[0]===L?isNaN(this.prerelease[1])&&(this.prerelease=[L,0]):this.prerelease=[L,0]);break;default:throw new Error("invalid increment argument: "+P)}return this.format(),this.raw=this.version,this},r.inc=function(P,L,A,le){typeof A=="string"&&(le=A,A=void 0);try{return new Ye(P,A).inc(L,le).version}catch{return null}},r.diff=function(P,L){if(Ag(P,L))return null;var A=vs(P),le=vs(L);if(A.prerelease.length||le.prerelease.length){for(var Ie in A)if((Ie==="major"||Ie==="minor"||Ie==="patch")&&A[Ie]!==le[Ie])return"pre"+Ie;return"prerelease"}for(var Ie in A)if((Ie==="major"||Ie==="minor"||Ie==="patch")&&A[Ie]!==le[Ie])return Ie},r.compareIdentifiers=ya;var Cb=/^[0-9]+$/;function ya(P,L){var A=Cb.test(P),le=Cb.test(L);return A&&le&&(P=+P,L=+L),A&&!le?-1:le&&!A?1:P<L?-1:P>L?1:0}function Oi(P,L,A){return new Ye(P,A).compare(new Ye(L,A))}function yp(P,L,A){return Oi(P,L,A)>0}function wp(P,L,A){return Oi(P,L,A)<0}function Ag(P,L,A){return Oi(P,L,A)===0}function _b(P,L,A){return Oi(P,L,A)!==0}function Mg(P,L,A){return Oi(P,L,A)>=0}function Og(P,L,A){return Oi(P,L,A)<=0}function Ip(P,L,A,le){var Ie;switch(L){case"===":typeof P=="object"&&(P=P.version),typeof A=="object"&&(A=A.version),Ie=P===A;break;case"!==":typeof P=="object"&&(P=P.version),typeof A=="object"&&(A=A.version),Ie=P!==A;break;case"":case"=":case"==":Ie=Ag(P,A,le);break;case"!=":Ie=_b(P,A,le);break;case">":Ie=yp(P,A,le);break;case">=":Ie=Mg(P,A,le);break;case"<":Ie=wp(P,A,le);break;case"<=":Ie=Og(P,A,le);break;default:throw new TypeError("Invalid operator: "+L)}return Ie}function xn(P,L){if(P instanceof xn){if(P.loose===L)return P;P=P.value}if(!(this instanceof xn))return new xn(P,L);n("comparator",P,L),this.loose=L,this.parse(P),this.semver===Jc?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}r.rcompareIdentifiers=function(P,L){return ya(L,P)},r.major=function(P,L){return new Ye(P,L).major},r.minor=function(P,L){return new Ye(P,L).minor},r.patch=function(P,L){return new Ye(P,L).patch},r.compare=Oi,r.compareLoose=function(P,L){return Oi(P,L,!0)},r.rcompare=function(P,L,A){return Oi(L,P,A)},r.sort=function(P,L){return P.sort((function(A,le){return r.compare(A,le,L)}))},r.rsort=function(P,L){return P.sort((function(A,le){return r.rcompare(A,le,L)}))},r.gt=yp,r.lt=wp,r.eq=Ag,r.neq=_b,r.gte=Mg,r.lte=Og,r.cmp=Ip,r.Comparator=xn;var Jc={};function Ut(P,L){if(P instanceof Ut)return P.loose===L?P:new Ut(P.raw,L);if(P instanceof xn)return new Ut(P.value,L);if(!(this instanceof Ut))return new Ut(P,L);if(this.loose=L,this.raw=P,this.set=P.split(/\s*\|\|\s*/).map((function(A){return this.parseRange(A.trim())}),this).filter((function(A){return A.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+P);this.format()}function Vr(P){return!P||P.toLowerCase()==="x"||P==="*"}function kk(P,L,A,le,Ie,ar,Ze,Zr,Kt,kr,si,$t,wr){return((L=Vr(A)?"":Vr(le)?">="+A+".0.0":Vr(Ie)?">="+A+"."+le+".0":">="+L)+" "+(Zr=Vr(Kt)?"":Vr(kr)?"<"+(+Kt+1)+".0.0":Vr(si)?"<"+Kt+"."+(+kr+1)+".0":$t?"<="+Kt+"."+kr+"."+si+"-"+$t:"<="+Zr)).trim()}function Rk(P,L){for(var A=0;A<P.length;A++)if(!P[A].test(L))return!1;if(L.prerelease.length){for(A=0;A<P.length;A++)if(n(P[A].semver),P[A].semver!==Jc&&P[A].semver.prerelease.length>0){var le=P[A].semver;if(le.major===L.major&&le.minor===L.minor&&le.patch===L.patch)return!0}return!1}return!0}function bp(P,L,A){try{L=new Ut(L,A)}catch{return!1}return L.test(P)}function Fg(P,L,A,le){var Ie,ar,Ze,Zr,Kt;switch(P=new Ye(P,le),L=new Ut(L,le),A){case">":Ie=yp,ar=Og,Ze=wp,Zr=">",Kt=">=";break;case"<":Ie=wp,ar=Mg,Ze=yp,Zr="<",Kt="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(bp(P,L,le))return!1;for(var kr=0;kr<L.set.length;++kr){var si=L.set[kr],$t=null,wr=null;if(si.forEach((function(en){en.semver===Jc&&(en=new xn(">=0.0.0")),$t=$t||en,wr=wr||en,Ie(en.semver,$t.semver,le)?$t=en:Ze(en.semver,wr.semver,le)&&(wr=en)})),$t.operator===Zr||$t.operator===Kt||(!wr.operator||wr.operator===Zr)&&ar(P,wr.semver)||wr.operator===Kt&&Ze(P,wr.semver))return!1}return!0}xn.prototype.parse=function(P){var L=this.loose?a[sr]:a[Br],A=P.match(L);if(!A)throw new TypeError("Invalid comparator: "+P);this.operator=A[1],this.operator==="="&&(this.operator=""),A[2]?this.semver=new Ye(A[2],this.loose):this.semver=Jc},xn.prototype.toString=function(){return this.value},xn.prototype.test=function(P){return n("Comparator.test",P,this.loose),this.semver===Jc||(typeof P=="string"&&(P=new Ye(P,this.loose)),Ip(P,this.operator,this.semver,this.loose))},xn.prototype.intersects=function(P,L){if(!(P instanceof xn))throw new TypeError("a Comparator is required");var A;if(this.operator==="")return A=new Ut(P.value,L),bp(this.value,A,L);if(P.operator==="")return A=new Ut(this.value,L),bp(P.semver,A,L);var le=!(this.operator!==">="&&this.operator!==">"||P.operator!==">="&&P.operator!==">"),Ie=!(this.operator!=="<="&&this.operator!=="<"||P.operator!=="<="&&P.operator!=="<"),ar=this.semver.version===P.semver.version,Ze=!(this.operator!==">="&&this.operator!=="<="||P.operator!==">="&&P.operator!=="<="),Zr=Ip(this.semver,"<",P.semver,L)&&(this.operator===">="||this.operator===">")&&(P.operator==="<="||P.operator==="<"),Kt=Ip(this.semver,">",P.semver,L)&&(this.operator==="<="||this.operator==="<")&&(P.operator===">="||P.operator===">");return le||Ie||ar&&Ze||Zr||Kt},r.Range=Ut,Ut.prototype.format=function(){return this.range=this.set.map((function(P){return P.join(" ").trim()})).join("||").trim(),this.range},Ut.prototype.toString=function(){return this.range},Ut.prototype.parseRange=function(P){var L=this.loose;P=P.trim(),n("range",P,L);var A=L?a[Gc]:a[oi];P=P.replace(A,kk),n("hyphen replace",P),P=P.replace(a[Be],"$1$2$3"),n("comparator trim",P,a[Be]),P=(P=(P=P.replace(a[G],"$1~")).replace(a[dt],"$1^")).split(/\s+/).join(" ");var le=L?a[sr]:a[Br],Ie=P.split(" ").map((function(ar){return(function(Ze,Zr){return n("comp",Ze),Ze=(function(Kt,kr){return Kt.trim().split(/\s+/).map((function(si){return(function($t,wr){n("caret",$t,wr);var en=wr?a[Zt]:a[tt];return $t.replace(en,(function(Nn,Ee,Ue,ht,_t){var Ir;return n("caret",$t,Nn,Ee,Ue,ht,_t),Vr(Ee)?Ir="":Vr(Ue)?Ir=">="+Ee+".0.0 <"+(+Ee+1)+".0.0":Vr(ht)?Ir=Ee==="0"?">="+Ee+"."+Ue+".0 <"+Ee+"."+(+Ue+1)+".0":">="+Ee+"."+Ue+".0 <"+(+Ee+1)+".0.0":_t?(n("replaceCaret pr",_t),_t.charAt(0)!=="-"&&(_t="-"+_t),Ir=Ee==="0"?Ue==="0"?">="+Ee+"."+Ue+"."+ht+_t+" <"+Ee+"."+Ue+"."+(+ht+1):">="+Ee+"."+Ue+"."+ht+_t+" <"+Ee+"."+(+Ue+1)+".0":">="+Ee+"."+Ue+"."+ht+_t+" <"+(+Ee+1)+".0.0"):(n("no pr"),Ir=Ee==="0"?Ue==="0"?">="+Ee+"."+Ue+"."+ht+" <"+Ee+"."+Ue+"."+(+ht+1):">="+Ee+"."+Ue+"."+ht+" <"+Ee+"."+(+Ue+1)+".0":">="+Ee+"."+Ue+"."+ht+" <"+(+Ee+1)+".0.0"),n("caret return",Ir),Ir}))})(si,kr)})).join(" ")})(Ze,Zr),n("caret",Ze),Ze=(function(Kt,kr){return Kt.trim().split(/\s+/).map((function(si){return(function($t,wr){var en=wr?a[ve]:a[ie];return $t.replace(en,(function(Nn,Ee,Ue,ht,_t){var Ir;return n("tilde",$t,Nn,Ee,Ue,ht,_t),Vr(Ee)?Ir="":Vr(Ue)?Ir=">="+Ee+".0.0 <"+(+Ee+1)+".0.0":Vr(ht)?Ir=">="+Ee+"."+Ue+".0 <"+Ee+"."+(+Ue+1)+".0":_t?(n("replaceTilde pr",_t),_t.charAt(0)!=="-"&&(_t="-"+_t),Ir=">="+Ee+"."+Ue+"."+ht+_t+" <"+Ee+"."+(+Ue+1)+".0"):Ir=">="+Ee+"."+Ue+"."+ht+" <"+Ee+"."+(+Ue+1)+".0",n("tilde return",Ir),Ir}))})(si,kr)})).join(" ")})(Ze,Zr),n("tildes",Ze),Ze=(function(Kt,kr){return n("replaceXRanges",Kt,kr),Kt.split(/\s+/).map((function(si){return(function($t,wr){$t=$t.trim();var en=wr?a[X]:a[Nr];return $t.replace(en,(function(Nn,Ee,Ue,ht,_t,Ir){n("xRange",$t,Nn,Ee,Ue,ht,_t,Ir);var kb=Vr(Ue),Qc=kb||Vr(ht),Xc=Qc||Vr(_t);return Ee==="="&&Xc&&(Ee=""),kb?Nn=Ee===">"||Ee==="<"?"<0.0.0":"*":Ee&&Xc?(Qc&&(ht=0),Xc&&(_t=0),Ee===">"?(Ee=">=",Qc?(Ue=+Ue+1,ht=0,_t=0):Xc&&(ht=+ht+1,_t=0)):Ee==="<="&&(Ee="<",Qc?Ue=+Ue+1:ht=+ht+1),Nn=Ee+Ue+"."+ht+"."+_t):Qc?Nn=">="+Ue+".0.0 <"+(+Ue+1)+".0.0":Xc&&(Nn=">="+Ue+"."+ht+".0 <"+Ue+"."+(+ht+1)+".0"),n("xRange return",Nn),Nn}))})(si,kr)})).join(" ")})(Ze,Zr),n("xrange",Ze),Ze=(function(Kt,kr){return n("replaceStars",Kt,kr),Kt.trim().replace(a[jc],"")})(Ze,Zr),n("stars",Ze),Ze})(ar,L)})).join(" ").split(/\s+/);return this.loose&&(Ie=Ie.filter((function(ar){return!!ar.match(le)}))),Ie=Ie.map((function(ar){return new xn(ar,L)}))},Ut.prototype.intersects=function(P,L){if(!(P instanceof Ut))throw new TypeError("a Range is required");return this.set.some((function(A){return A.every((function(le){return P.set.some((function(Ie){return Ie.every((function(ar){return le.intersects(ar,L)}))}))}))}))},r.toComparators=function(P,L){return new Ut(P,L).set.map((function(A){return A.map((function(le){return le.value})).join(" ").trim().split(" ")}))},Ut.prototype.test=function(P){if(!P)return!1;typeof P=="string"&&(P=new Ye(P,this.loose));for(var L=0;L<this.set.length;L++)if(Rk(this.set[L],P))return!0;return!1},r.satisfies=bp,r.maxSatisfying=function(P,L,A){var le=null,Ie=null;try{var ar=new Ut(L,A)}catch{return null}return P.forEach((function(Ze){ar.test(Ze)&&(le&&Ie.compare(Ze)!==-1||(Ie=new Ye(le=Ze,A)))})),le},r.minSatisfying=function(P,L,A){var le=null,Ie=null;try{var ar=new Ut(L,A)}catch{return null}return P.forEach((function(Ze){ar.test(Ze)&&(le&&Ie.compare(Ze)!==1||(Ie=new Ye(le=Ze,A)))})),le},r.validRange=function(P,L){try{return new Ut(P,L).range||"*"}catch{return null}},r.ltr=function(P,L,A){return Fg(P,L,"<",A)},r.gtr=function(P,L,A){return Fg(P,L,">",A)},r.outside=Fg,r.prerelease=function(P,L){var A=vs(P,L);return A&&A.prerelease.length?A.prerelease:null},r.intersects=function(P,L,A){return P=new Ut(P,A),L=new Ut(L,A),P.intersects(L)},r.coerce=function(P){if(P instanceof Ye)return P;if(typeof P!="string")return null;var L=P.match(a[$]);return L==null?null:vs((L[1]||"0")+"."+(L[2]||"0")+"."+(L[3]||"0"))}}).call(this,e(1))},function(o,r){var e,t,n=o.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(S){if(e===setTimeout)return setTimeout(S,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(S,0);try{return e(S,0)}catch{try{return e.call(null,S,0)}catch{return e.call(this,S,0)}}}(function(){try{e=typeof setTimeout=="function"?setTimeout:i}catch{e=i}try{t=typeof clearTimeout=="function"?clearTimeout:s}catch{t=s}})();var l,c=[],d=!1,u=-1;function f(){d&&l&&(d=!1,l.length?c=l.concat(c):u=-1,c.length&&m())}function m(){if(!d){var S=a(f);d=!0;for(var I=c.length;I;){for(l=c,c=[];++u<I;)l&&l[u].run();u=-1,I=c.length}l=null,d=!1,(function(k){if(t===clearTimeout)return clearTimeout(k);if((t===s||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(k);try{t(k)}catch{try{return t.call(null,k)}catch{return t.call(this,k)}}})(S)}}function y(S,I){this.fun=S,this.array=I}function v(){}n.nextTick=function(S){var I=new Array(arguments.length-1);if(arguments.length>1)for(var k=1;k<arguments.length;k++)I[k-1]=arguments[k];c.push(new y(S,I)),c.length!==1||d||a(m)},y.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=v,n.addListener=v,n.once=v,n.off=v,n.removeListener=v,n.removeAllListeners=v,n.emit=v,n.prependListener=v,n.prependOnceListener=v,n.listeners=function(S){return[]},n.binding=function(S){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(S){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}}])}));Gue=Fe.exports.SEMVER_SPEC_VERSION,jue=Fe.exports.parse,$T=Fe.exports.valid,Jue=Fe.exports.coerce,Que=Fe.exports.clean,Xue=Fe.exports.inc,Yue=Fe.exports.major,Zue=Fe.exports.minor,epe=Fe.exports.patch,tpe=Fe.exports.prerelease,qT=Fe.exports.gt,rpe=Fe.exports.gte,npe=Fe.exports.lt,ipe=Fe.exports.lte,zT=Fe.exports.eq,ope=Fe.exports.neq,spe=Fe.exports.cmp,ape=Fe.exports.compare,lpe=Fe.exports.rcompare,cpe=Fe.exports.compareIdentifiers,dpe=Fe.exports.rcompareIdentifiers,upe=Fe.exports.compareBuild,ppe=Fe.exports.sort,fpe=Fe.exports.rsort,mpe=Fe.exports.diff,hpe=Fe.exports.validRange,gpe=Fe.exports.satisfies,vpe=Fe.exports.maxSatisfying,ype=Fe.exports.minSatisfying,wpe=Fe.exports.minVersion,Ipe=Fe.exports.gtr,bpe=Fe.exports.ltr,Spe=Fe.exports.outside,xpe=Fe.exports.intersects,Ppe=Fe.exports.SemVer,Epe=Fe.exports.Comparator,Tpe=Fe.exports.Range});var vA,jT,JT=w(()=>{vA={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:14},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"},windsurfAcp:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfAcp.d.ts"},windsurfAnnotations:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfAnnotations.d.ts"},windsurfAudio:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfAudio.d.ts"},windsurfAuth:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfAuth.d.ts"},windsurfCascade:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfCascade.d.ts"},windsurfCommandPopup:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfCommandPopup.d.ts"},windsurfDebug:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfDebug.d.ts"},windsurfDevContainers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfDevContainers.d.ts"},windsurfDiffZone:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfDiffZone.d.ts"},windsurfEditorCommandPopup:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfEditorCommandPopup.d.ts"},windsurfEditorNudge:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfEditorNudge.d.ts"},windsurfExtensionManager:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfExtensionManager.d.ts"},windsurfExtensionMetadata:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfExtensionMetadata.d.ts"},windsurfFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfFiles.d.ts"},windsurfGenerateCommitMessageButton:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfGenerateCommitMessageButton.d.ts"},windsurfInlineCompletions:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfInlineCompletions.d.ts"},windsurfLanguageServer:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfLanguageServer.d.ts"},windsurfMarkers:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfMarkers.d.ts"},windsurfMcp:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfMcp.d.ts"},windsurfProductEducation:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfProductEducation.d.ts"},windsurfSettings:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfSettings.d.ts"},windsurfSideHint:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfSideHint.d.ts"},windsurfStatusBar:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfStatusBar.d.ts"},windsurfTabToJump:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfTabToJump.d.ts"},windsurfTerminalCommandPopup:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfTerminalCommandPopup.d.ts"},windsurfUndoRedo:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.windsurfUndoRedo.d.ts"},workspaceTrust:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts"}},jT=Object.freeze(vA)});function wA(o){return o=o.trim(),o==="*"||QT.test(o)}function AI(o){if(!wA(o))return null;if(o=o.trim(),o==="*")return{hasCaret:!1,hasGreaterEquals:!1,majorBase:0,majorMustEqual:!1,minorBase:0,minorMustEqual:!1,patchBase:0,patchMustEqual:!1,preRelease:null};let r=o.match(QT);return r?{hasCaret:r[1]==="^",hasGreaterEquals:r[1]===">=",majorBase:r[2]==="x"?0:parseInt(r[2],10),majorMustEqual:r[2]!=="x",minorBase:r[4]==="x"?0:parseInt(r[4],10),minorMustEqual:r[4]!=="x",patchBase:r[6]==="x"?0:parseInt(r[6],10),patchMustEqual:r[6]!=="x",preRelease:r[8]||null}:null}function MI(o){if(!o)return null;let r=o.majorBase,e=o.majorMustEqual,t=o.minorBase,n=o.minorMustEqual,i=o.patchBase,s=o.patchMustEqual;o.hasCaret&&(r===0||(n=!1),s=!1);let a=0;if(o.preRelease){let l=yA.exec(o.preRelease);if(l){let[,c,d,u,f,m]=l;a=Date.UTC(Number(c),Number(d)-1,Number(u),Number(f)||0,Number(m)||0)}}return{majorBase:r,majorMustEqual:e,minorBase:t,minorMustEqual:n,patchBase:i,patchMustEqual:s,isMinimum:o.hasGreaterEquals,notBefore:a}}function IA(o,r,e){let t;typeof o=="string"?t=MI(AI(o)):t=o;let n;r instanceof Date?n=r.getTime():typeof r=="string"&&(n=new Date(r).getTime());let i;if(typeof e=="string"?i=MI(AI(e)):i=e,!t||!i)return!1;let s=t.majorBase,a=t.minorBase,l=t.patchBase,c=i.majorBase,d=i.minorBase,u=i.patchBase,f=i.notBefore,m=i.majorMustEqual,y=i.minorMustEqual,v=i.patchMustEqual;return i.isMinimum?s>c?!0:s<c?!1:a>d?!0:a<d||n&&n<f?!1:l>=u:(s===1&&c===0&&(!m||!y||!v)&&(c=1,d=0,u=0,m=!0,y=!1,v=!1),s<c?!1:s>c?!m:a<d?!1:a>d?!y:l<u?!1:l>u?!v:!(n&&n<f))}function XT(o,r,e,t,n,i){let s=[];if(typeof t.publisher<"u"&&typeof t.publisher!="string")return s.push([Oe.Error,h(2050,null)]),s;if(typeof t.name!="string")return s.push([Oe.Error,h(2049,null,"name")]),s;if(typeof t.version!="string")return s.push([Oe.Error,h(2051,null,"version")]),s;if(!t.engines)return s.push([Oe.Error,h(2042,null,"engines")]),s;if(typeof t.engines.vscode!="string")return s.push([Oe.Error,h(2043,null,"engines.vscode")]),s;if(typeof t.extensionDependencies<"u"&&!LI(t.extensionDependencies))return s.push([Oe.Error,h(2045,null,"extensionDependencies")]),s;if(typeof t.extensionAffinity<"u"&&!LI(t.extensionAffinity))return s.push([Oe.Error,h(2044,null,"extensionAffinity")]),s;if(typeof t.activationEvents<"u"){if(!LI(t.activationEvents))return s.push([Oe.Error,h(2038,null,"activationEvents")]),s;if(typeof t.main>"u"&&typeof t.browser>"u")return s.push([Oe.Error,h(2039,null,"activationEvents","main","browser")]),s}if(typeof t.extensionKind<"u"&&typeof t.main>"u"&&s.push([Oe.Warning,h(2046,null,"extensionKind")]),typeof t.main<"u"){if(typeof t.main!="string")return s.push([Oe.Error,h(2047,null,"main")]),s;{let c=fe(e,t.main);_v(c,e)||s.push([Oe.Warning,h(2048,null,c.path,e.path)])}}if(typeof t.browser<"u"){if(typeof t.browser!="string")return s.push([Oe.Error,h(2040,null,"browser")]),s;{let c=fe(e,t.browser);_v(c,e)||s.push([Oe.Warning,h(2041,null,c.path,e.path)])}}if(!$T(t.version))return s.push([Oe.Error,h(2052,null)]),s;let a=[];if(!bA(o,r,t,n,a))for(let c of a)s.push([Oe.Error,c]);if(i&&t.enabledApiProposals?.length){let c=[];if(!SA([...t.enabledApiProposals],c))for(let d of c)s.push([Oe.Error,d])}return s}function bA(o,r,e,t,n){return t||typeof e.main>"u"&&typeof e.browser>"u"?!0:xA(o,r,e.engines.vscode,n)}function SA(o,r){if(o.length===0)return!0;let e=Array.isArray(r)?r:void 0,t=(Array.isArray(r)?void 0:r)??jT,n=[],i=AT(o);for(let{proposalName:s,version:a}of i){if(!a)continue;t[s]?.version!==a&&n.push(s)}return n.length?(e&&(n.length===1?e.push(h(2036,null,n[0])):e.push(h(2037,null,n.slice(0,n.length-1).map(s=>`'${s}'`).join(", "),n[n.length-1]))),!1):!0}function xA(o,r,e,t=[]){let n=MI(AI(e));if(!n)return t.push(h(2056,null,e)),!1;if(n.majorBase===0){if(!n.majorMustEqual||!n.minorMustEqual)return t.push(h(2054,null,e)),!1}else if(!n.majorMustEqual)return t.push(h(2055,null,e)),!1;return IA(o,r,n)?!0:(t.push(h(2053,null,o,e)),!1)}function LI(o){if(!Array.isArray(o))return!1;for(let r=0,e=o.length;r<e;r++)if(typeof o[r]!="string")return!1;return!0}var QT,yA,YT=w(()=>{yt();bu();Ce();WI();Zu();JT();QT=/^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,yA=/^-(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?$/});function ZT(o,r,e,t){try{PA(o,r,e,t)}catch(n){o.error(n?.message??n)}return r}function PA(o,r,e,t){let n=(i,s,a)=>{let l=i[s];if(Ae(l)){let c=l,d=c.length;if(d>1&&c[0]==="%"&&c[d-1]==="%"){let u=c.substr(1,d-2),f=e[u];f===void 0&&t&&(f=t[u]);let m=typeof f=="string"?f:f?.message,y=t?.[u],v=typeof y=="string"?y:y?.message;if(!m){v||o.warn(`[${r.name}]: ${h(2021,null,u)}`);return}if(a&&(s==="title"||s==="category")&&v&&v!==m){let S={value:m,original:v};i[s]=S}else i[s]=m}}else if(Je(l))for(let c in l)l.hasOwnProperty(c)&&(c==="commands"?n(l,c,!0):n(l,c,a));else if(Array.isArray(l))for(let c=0;c<l.length;c++)n(l,c,a)};for(let i in r)r.hasOwnProperty(i)&&n(r,i)}var eC=w(()=>{We();Ce()});var tC,rC,tp,ua,fc,mc,Jh,OI=w(()=>{zt();he();yn();nt();Ve();Zn();KT();K();ze();Se();Y();yt();WI();bu();se();Ce();qr();DI();Zu();YT();je();Z();re();Qt();Q();Dd();ep();Yn();Xn();eC();(r=>{function o(e,t){if(e===t)return!0;let n=Object.keys(e),i=new Set;for(let s of Object.keys(t))i.add(s);if(n.length!==i.size)return!1;for(let s of n){if(e[s]!==t[s])return!1;i.delete(s)}return i.size===0}r.equals=o})(tC||={});rC=W("IExtensionsScannerService"),tp=class extends C{constructor(e,t,n,i,s,a,l,c,d,u,f,m){super();this.systemExtensionsLocation=e;this.userExtensionsLocation=t;this.extensionsControlLocation=n;this.userDataProfilesService=s;this.extensionsProfileScannerService=a;this.fileService=l;this.logService=c;this.environmentService=d;this.productService=u;this.uriIdentityService=f;this.instantiationService=m;this._onDidChangeCache=this._register(new x);this.onDidChangeCache=this._onDidChangeCache.event;this.initializeDefaultProfileExtensionsPromise=void 0;this.systemExtensionsCachedScanner=this._register(this.instantiationService.createInstance(mc,i)),this.userExtensionsCachedScanner=this._register(this.instantiationService.createInstance(mc,i)),this.extensionsScanner=this._register(this.instantiationService.createInstance(fc)),this._register(this.systemExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(0))),this._register(this.userExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(1)))}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=VT(this.fileService,this.logService)),this._targetPlatformPromise}async scanAllExtensions(e,t){let[n,i]=await Promise.all([this.scanSystemExtensions(e),this.scanUserExtensions(t)]);return this.dedupExtensions(n,i,[],await this.getTargetPlatform(),!0)}async scanSystemExtensions(e){let t=[];t.push(this.scanDefaultSystemExtensions(e.language)),t.push(this.scanDevSystemExtensions(e.language,!!e.checkControlFile));let[n,i]=await Promise.all(t);return this.applyScanOptions([...n,...i],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,n=await this.createExtensionScannerInput(e.profileLocation,!0,1,e.language,!0,t,e.productVersion??this.getProductVersion()),i=e.useCache&&!n.devMode?this.userExtensionsCachedScanner:this.extensionsScanner,s;try{s=await i.scanExtensions(n)}catch(a){if(a instanceof da&&a.code==="ERROR_PROFILE_NOT_FOUND")await this.doInitializeDefaultProfileExtensions(),s=await i.scanExtensions(n);else throw a}return s=await this.applyScanOptions(s,1,{includeInvalid:e.includeInvalid,pickLatest:!0}),this.logService.trace("Scanned user extensions:",s.length),s}async scanAllUserExtensions(e={includeInvalid:!0,includeAllVersions:!0}){let t=await this.createExtensionScannerInput(this.userExtensionsLocation,!1,1,void 0,!0,void 0,this.getProductVersion()),n=await this.extensionsScanner.scanExtensions(t);return this.applyScanOptions(n,1,{includeAllVersions:e.includeAllVersions,includeInvalid:e.includeInvalid})}async scanExtensionsUnderDevelopment(e,t){if(this.environmentService.isExtensionDevelopment&&this.environmentService.extensionDevelopmentLocationURI){let n=(await Promise.all(this.environmentService.extensionDevelopmentLocationURI.filter(i=>i.scheme===N.file).map(async i=>{let s=await this.createExtensionScannerInput(i,!1,1,t.language,!1,void 0,this.getProductVersion());return(await this.extensionsScanner.scanOneOrMultipleExtensions(s)).map(l=>(l.type=e.find(c=>ca(c.identifier,l.identifier))?.type??l.type,this.extensionsScanner.validate(l,s)))}))).flat();return this.applyScanOptions(n,"development",{includeInvalid:t.includeInvalid,pickLatest:!0})}return[]}async scanExistingExtension(e,t,n){let i=await this.createExtensionScannerInput(e,!1,t,n.language,!0,void 0,this.getProductVersion()),s=await this.extensionsScanner.scanExtension(i);return!s||!n.includeInvalid&&!s.isValid?null:s}async scanOneOrMultipleExtensions(e,t,n){let i=await this.createExtensionScannerInput(e,!1,t,n.language,!0,void 0,this.getProductVersion()),s=await this.extensionsScanner.scanOneOrMultipleExtensions(i);return this.applyScanOptions(s,t,{includeInvalid:n.includeInvalid,pickLatest:!0})}async scanMultipleExtensions(e,t,n){let i=[];return await Promise.all(e.map(async s=>{let a=await this.scanOneOrMultipleExtensions(s,t,n);i.push(...a)})),this.applyScanOptions(i,t,{includeInvalid:n.includeInvalid,pickLatest:!0})}async updateManifestMetadata(e,t){let n=fe(e,"package.json"),i=(await this.fileService.readFile(n)).value.toString(),s=JSON.parse(i);s.__metadata={...s.__metadata,...t},await this.fileService.writeFile(fe(e,"package.json"),H.fromString(JSON.stringify(s,null,"	")))}async initializeDefaultProfileExtensions(){try{await this.extensionsProfileScannerService.scanProfileExtensions(this.userDataProfilesService.defaultProfile.extensionsResource,{bailOutWhenFileNotFound:!0})}catch(e){if(e instanceof da&&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,H.fromString(JSON.stringify([])))}catch(t){jr(t)!==1&&this.logService.warn("Failed to create default profile extensions manifest in extensions installation folder.",this.userExtensionsLocation.toString(),qt(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,n={}){return n.includeAllVersions||(e=this.dedupExtensions(t===0?e:void 0,t===1?e:void 0,t==="development"?e:void 0,await this.getTargetPlatform(),!!n.pickLatest)),n.includeInvalid||(e=e.filter(i=>i.isValid)),e.sort((i,s)=>{let a=ye(i.location.fsPath),l=ye(s.location.fsPath);return a<l?-1:a>l?1:0})}dedupExtensions(e,t,n,i,s){let a=(c,d,u)=>{if(!u){if(c.metadata?.isApplicationScoped&&!d.metadata?.isApplicationScoped)return!1;if(!c.metadata?.isApplicationScoped&&d.metadata?.isApplicationScoped)return!0}if(c.isValid&&!d.isValid)return!1;if(c.isValid===d.isValid){if(s&&qT(c.manifest.version,d.manifest.version))return this.logService.debug(`Skipping extension ${d.location.path} with lower version ${d.manifest.version} in favour of ${c.location.path} with version ${c.manifest.version}`),!1;if(zT(c.manifest.version,d.manifest.version)){if(c.type===0)return this.logService.debug(`Skipping extension ${d.location.path} in favour of system extension ${c.location.path} with same version`),!1;if(c.targetPlatform===i)return this.logService.debug(`Skipping extension ${d.location.path} from different target platform ${d.targetPlatform}`),!1}}return u?this.logService.warn(`Overwriting user extension ${c.location.path} with ${d.location.path}.`):this.logService.debug(`Overwriting user extension ${c.location.path} with ${d.location.path}.`),!0},l=new $h;return e?.forEach(c=>{let d=l.get(c.identifier.id);(!d||a(d,c,!1))&&l.set(c.identifier.id,c)}),t?.forEach(c=>{let d=l.get(c.identifier.id);if(!d&&e&&c.type===0){this.logService.debug(`Skipping obsolete system extension ${c.location.path}.`);return}(!d||a(d,c,!1))&&l.set(c.identifier.id,c)}),n?.forEach(c=>{let d=l.get(c.identifier.id);(!d||a(d,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()),i=await(t.devMode?this.extensionsScanner:this.systemExtensionsCachedScanner).scanExtensions(t);return this.logService.trace("Scanned system extensions:",i.length),i}async scanDevSystemExtensions(e,t){let n=this.environmentService.isBuilt?[]:this.productService.builtInExtensions;if(!n?.length)return[];this.logService.trace("Started scanning dev system extensions");let i=t?await this.getBuiltInExtensionControl():{},s=[],a=b.file(kt(U(et.asFileUri("").fsPath,"..",".build","builtInExtensions")));for(let c of n){let d=i[c.name]||"marketplace";switch(d){case"disabled":break;case"marketplace":s.push(fe(a,c.name));break;default:s.push(b.file(d));break}}let l=await Promise.all(s.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),at(l)}async getBuiltInExtensionControl(){try{let e=await this.fileService.readFile(this.extensionsControlLocation);return JSON.parse(e.value.toString())}catch{return{}}}async createExtensionScannerInput(e,t,n,i,s,a,l){let c=await this.getTranslations(i??fn),d=await this.getMtime(e),u=t&&!this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)?this.userDataProfilesService.defaultProfile.extensionsResource:void 0,f=u?await this.getMtime(u):void 0;return new ua(e,d,u,f,t,a,n,s,l.version,l.date,this.productService.commit,!this.environmentService.isBuilt,i,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}}};tp=T([g(4,_r),g(5,ps),g(6,ke),g(7,O),g(8,$r),g(9,_e),g(10,Dt),g(11,Vt)],tp);ua=class{constructor(r,e,t,n,i,s,a,l,c,d,u,f,m,y){this.location=r;this.mtime=e;this.applicationExtensionslocation=t;this.applicationExtensionslocationMtime=n;this.profile=i;this.profileScanOptions=s;this.type=a;this.validate=l;this.productVersion=c;this.productDate=d;this.productCommit=u;this.devMode=f;this.language=m;this.translations=y}static createNlsConfiguration(r){return{language:r.language,pseudo:r.language==="pseudo",devMode:r.devMode,translations:r.translations}}static equals(r,e){return md(r.location,e.location)&&r.mtime===e.mtime&&md(r.applicationExtensionslocation,e.applicationExtensionslocation)&&r.applicationExtensionslocationMtime===e.applicationExtensionslocationMtime&&r.profile===e.profile&&cn(r.profileScanOptions,e.profileScanOptions)&&r.type===e.type&&r.validate===e.validate&&r.productVersion===e.productVersion&&r.productDate===e.productDate&&r.productCommit===e.productCommit&&r.devMode===e.devMode&&r.language===e.language&&tC.equals(r.translations,e.translations)}},fc=class extends C{constructor(e,t,n,i,s,a){super();this.extensionsProfileScannerService=e;this.uriIdentityService=t;this.fileService=n;this.environmentService=s;this.logService=a;this.extensionsEnabledWithApiProposalVersion=i.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 n=await Promise.all(t.children.map(async i=>{if(!i.isDirectory||e.type===1&&Kr(i.resource).indexOf(".")===0)return null;let s=new ua(i.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(s)}));return at(n).sort((i,s)=>i.location.path<s.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(i=>!i.metadata?.isApplicationScoped);let n=await this.scanExtensionsFromProfileResource(e.applicationExtensionslocation,i=>!!i.metadata?.isBuiltin||!!i.metadata?.isApplicationScoped,e);t.push(...n)}return t}async scanExtensionsFromProfileResource(e,t,n){let i=await this.extensionsProfileScannerService.scanProfileExtensions(e,n.profileScanOptions);if(!i.length)return[];let s=await Promise.all(i.map(async a=>{if(t(a)){let l=new ua(a.location,n.mtime,n.applicationExtensionslocation,n.applicationExtensionslocationMtime,n.profile,n.profileScanOptions,n.type,n.validate,n.productVersion,n.productDate,n.productCommit,n.devMode,n.language,n.translations);return this.scanExtension(l,a)}return null}));return at(s)}async scanOneOrMultipleExtensions(e){try{if(await this.fileService.exists(fe(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}:`,qt(t)),[]}}async scanExtension(e,t){let n=[],i=!0,s;try{s=await this.scanExtensionManifest(e.location)}catch(m){if(t){n.push([Oe.Error,qt(m)]),i=!1;let[y,v]=t.identifier.id.split(".");s={name:v,publisher:y,version:t.version,engines:{vscode:""}}}else return e.type!==0&&this.logService.error(m),null}s.publisher||(s.publisher=qh);let a;t?a={...t.metadata,size:s.__metadata?.size}:s.__metadata&&(a={installedTimestamp:s.__metadata.installedTimestamp,size:s.__metadata.size,targetPlatform:s.__metadata.targetPlatform}),delete s.__metadata;let l=BT(s.publisher,s.name),c=a?.id?{id:l,uuid:a.id}:{id:l},d=a?.isSystem?0:e.type,u=d===0||!!a?.isBuiltin;try{s=await this.translateManifest(e.location,s,ua.createNlsConfiguration(e))}catch(m){this.logService.warn("Failed to translate manifest",qt(m))}let f={type:d,identifier:c,manifest:s,location:e.location,isBuiltin:u,targetPlatform:a?.targetPlatform??"undefined",publisherDisplayName:a?.publisherDisplayName,metadata:a,isValid:i,validations:n,preRelease:!!a?.preRelease};return e.validate&&(f=this.validate(f,e)),s.enabledApiProposals&&(!this.environmentService.isBuilt||this.extensionsEnabledWithApiProposalVersion.includes(l.toLowerCase()))&&(s.originalEnabledApiProposals=s.enabledApiProposals,s.enabledApiProposals=MT([...s.enabledApiProposals])),f}validate(e,t){let n=e.isValid,i=this.environmentService.isBuilt&&this.extensionsEnabledWithApiProposalVersion.includes(e.identifier.id.toLowerCase()),s=XT(t.productVersion,t.productDate,t.location,e.manifest,e.isBuiltin,i);for(let[a,l]of s)a===Oe.Error&&(n=!1,this.logService.error(this.formatMessage(t.location,l)));return e.isValid=n,e.validations=[...e.validations,...s],e}async scanExtensionManifest(e){let t=fe(e,"package.json"),n;try{n=(await this.fileService.readFile(t)).value.toString()}catch(s){throw jr(s)!==1&&this.logService.error(this.formatMessage(e,h(2022,null,t.path,s.message))),s}let i;try{i=JSON.parse(n)}catch(s){let a=[];Rn(n,a);for(let l of a)this.logService.error(this.formatMessage(e,h(2024,null,t.path,l.offset,l.length,Gh(l.error))));throw s}if(Go(i)!=="object"){let s=this.formatMessage(e,h(2025,null,t.path));throw this.logService.error(s),new Error(s)}return i}async translateManifest(e,t,n){let i=await this.getLocalizedMessages(e,t,n);if(i)try{let s=[],a=await this.resolveOriginalMessageBundle(i.default,s);if(s.length>0)return s.forEach(c=>{this.logService.error(this.formatMessage(e,h(2026,null,i.default?.path,Gh(c.error))))}),t;if(Go(i)!=="object")return this.logService.error(this.formatMessage(e,h(2023,null,i.default?.path))),t;let l=i.values||Object.create(null);return ZT(this.logService,t,l,a)}catch{}return t}async getLocalizedMessages(e,t,n){let i=fe(e,"package.nls.json"),s=(d,u)=>{u.forEach(f=>{this.logService.error(this.formatMessage(e,h(2026,null,d?.path,Gh(f.error))))})},a=d=>{this.logService.error(this.formatMessage(e,h(2023,null,d?.path)))},l=`${t.publisher}.${t.name}`,c=n.translations[l];if(c)try{let d=b.file(c),u=(await this.fileService.readFile(d)).value.toString(),f=[],m=Rn(u,f);return f.length>0?(s(d,f),{values:void 0,default:i}):Go(m)!=="object"?(a(d),{values:void 0,default:i}):{values:m.contents?m.contents.package:void 0,default:i}}catch{return{values:void 0,default:i}}else{if(!await this.fileService.exists(i))return;let u;try{u=await this.findMessageBundles(e,n)}catch{return}if(!u.localized)return{values:void 0,default:u.original};try{let f=(await this.fileService.readFile(u.localized)).value.toString(),m=[],y=Rn(f,m);return m.length>0?(s(u.localized,m),{values:void 0,default:u.original}):Go(y)!=="object"?(a(u.localized),{values:void 0,default:u.original}):{values:y,default:u.original}}catch{return{values:void 0,default:u.original}}}}async resolveOriginalMessageBundle(e,t){if(e)try{let n=(await this.fileService.readFile(e)).value.toString();return Rn(n,t)}catch{}}findMessageBundles(e,t){return new Promise((n,i)=>{let s=a=>{let l=fe(e,`package.nls.${a}.json`);this.fileService.exists(l).then(c=>{c&&n({localized:l,original:fe(e,"package.nls.json")});let d=a.lastIndexOf("-");d===-1?n({localized:fe(e,"package.nls.json"),original:null}):(a=a.substring(0,d),s(a))})};if(t.devMode||t.pseudo||!t.language)return n({localized:fe(e,"package.nls.json"),original:null});s(t.language)})}formatMessage(e,t){return`[${e.path}]: ${t}`}};fc=T([g(0,ps),g(1,Dt),g(2,ke),g(3,_e),g(4,$r),g(5,O)],fc);mc=class extends fc{constructor(e,t,n,i,s,a,l,c){super(n,i,s,a,l,c);this.currentProfile=e;this.userDataProfilesService=t;this.cacheValidatorThrottler=this._register(new Pr(3e3));this._onDidChangeCache=this._register(new x);this.onDidChangeCache=this._onDidChangeCache.event}async scanExtensions(e){let t=this.getCacheFile(e),n=await this.readExtensionCache(t);if(this.input=e,n&&n.input&&ua.equals(n.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()),n.result.map(s=>(s.location=b.revive(s.location),s));let i=await super.scanExtensions(e);return await this.writeExtensionCache(t,{input:e,result:i}),i}async readExtensionCache(e){try{let t=await this.fileService.readFile(e),n=JSON.parse(t.value.toString());return{result:n.result,input:Jn(n.input)}}catch(t){jr(t)!==1&&this.logService.debug("Error while reading the extension cache file:",e.path,qt(t))}return null}async writeExtensionCache(e,t){try{await this.fileService.writeFile(e,H.fromString(JSON.stringify(t)))}catch(n){this.logService.debug("Error while writing the extension cache file:",e.path,qt(n))}}async validateCache(){if(!this.input)return;let e=this.getCacheFile(this.input),t=await this.readExtensionCache(e);if(!t)return;let n=t.result,i=JSON.parse(JSON.stringify(await super.scanExtensions(this.input)));if(!cn(i,n))try{this.logService.info("Invalidating Cache",n,i),await this.fileService.del(e),this._onDidChangeCache.fire()}catch(s){this.logService.error(s)}}getCacheFile(e){let t=this.getProfile(e);return this.uriIdentityService.extUri.joinPath(t.cacheHome,e.type===0?LT:WT)}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}};mc=T([g(1,_r),g(2,ps),g(3,Dt),g(4,ke),g(5,_e),g(6,$r),g(7,O)],mc);Jh=class extends tp{constructor(r,e,t,n,i,s,a,l,c,d,u,f){super(r,e,fe(t,".vscode-oss-dev","extensions","control.json"),n,i,s,a,l,c,d,u,f),this.translationsPromise=(async()=>{if(Jg)try{let m=await this.fileService.readFile(b.file(Jg));return JSON.parse(m.value.toString())}catch{}return Object.create(null)})()}getTranslations(r){return this.translationsPromise}}});var hc,nC=w(()=>{se();qr();ep();OI();je();Z();re();Qt();Xn();Yn();hc=class extends Jh{constructor(r,e,t,n,i,s,a,l){super(b.file(i.builtinExtensionsPath),b.file(i.extensionsPath),i.userHome,r.defaultProfile,r,e,t,n,i,s,a,l)}};hc=T([g(0,_r),g(1,ps),g(2,ke),g(3,O),g(4,fr),g(5,_e),g(6,Dt),g(7,Vt)],hc)});var gc,Qh=w(()=>{Z();gc=W("systemMonitorService")});var vc,iC=w(()=>{K();xt();xi();qo();hr();he();Wt();vc=class extends C{constructor(e,t,n){super();this.userDataProfilesService=t;this.windowsMainService=n;this._register(e.onWillLoadWindow(i=>{i.reason===2&&this.unsetProfileForWorkspace(i.window)})),this._register(e.onBeforeCloseWindow(i=>this.unsetProfileForWorkspace(i))),this._register(new pr(()=>this.cleanUpEmptyWindowAssociations(),30*1e3)).schedule()}async unsetProfileForWorkspace(e){let t=this.getWorkspace(e),n=this.userDataProfilesService.getProfileForWorkspace(t);n?.isTransient&&(this.userDataProfilesService.unsetWorkspace(t,n.isTransient),n.isTransient&&await this.userDataProfilesService.cleanUpTransientProfiles())}getWorkspace(e){return e.openedWorkspace??No(e.backupPath,e.isExtensionDevelopmentHost)}cleanUpEmptyWindowAssociations(){let e=this.userDataProfilesService.getAssociatedEmptyWindows();if(e.length===0)return;let t=this.windowsMainService.getWindows().map(n=>this.getWorkspace(n));for(let n of e)t.some(i=>i.id===n.id)||this.userDataProfilesService.unsetWorkspace(n,!1)}};vc=T([g(0,me),g(1,Or),g(2,Le)],vc)});var Xh,oC=w(()=>{Q();K();Hs();Xh=class extends C{constructor(e,t,n){super();this.storageMainService=e;this.userDataProfilesService=t;this.logService=n;let i=this._register(new er);this._onDidChange=this._register(new x({onWillAddFirstListener:()=>i.value=this.registerStorageChangeListeners(),onDidRemoveLastListener:()=>i.value=void 0}))}registerStorageChangeListeners(){this.logService.debug("ProfileStorageChangesListenerChannel#registerStorageChangeListeners");let e=new te;return e.add(E.debounce(this.storageMainService.applicationStorage.onDidChangeStorage,(t,n)=>(t?t.push(n.key):t=[n.key],t),100)(t=>this.onDidChangeApplicationStorage(t))),e.add(E.debounce(this.storageMainService.onDidChangeProfileStorage,(t,n)=>{t||(t=new Map);let i=t.get(n.profile.id);return i||t.set(n.profile.id,i={profile:n.profile,keys:[],storage:n.storage}),i.keys.push(n.key),t},100)(t=>this.onDidChangeProfileStorage(t))),e}onDidChangeApplicationStorage(e){let t=e.includes(ro)?[this.userDataProfilesService.defaultProfile]:[],n=[];if(e=e.filter(i=>i!==ro),e.length){let i=sm(this.storageMainService.applicationStorage.storage);n.push({profile:this.userDataProfilesService.defaultProfile,changes:e.map(s=>({key:s,scope:0,target:i[s]}))})}this.triggerEvents(t,n)}onDidChangeProfileStorage(e){let t=[],n=new Map;for(let[i,s]of e.entries()){s.keys.includes(ro)&&t.push(s.profile);let a=s.keys.filter(l=>l!==ro);if(a.length){let l=sm(s.storage.storage);n.set(i,{profile:s.profile,changes:a.map(c=>({key:c,scope:0,target:l[c]}))})}}this.triggerEvents(t,[...n.values()])}triggerEvents(e,t){(e.length||t.length)&&this._onDidChange.fire({valueChanges:t,targetChanges:e})}listen(e,t,n){if(t==="onDidChange")return this._onDidChange.event;throw new Error(`[ProfileStorageChangesListenerChannel] Event not found: ${t}`)}async call(e,t){throw new Error(`Call not found: ${t}`)}}});async function sC(o,r){let e=o.getItem(um);return(typeof e!="string"||V&&e==="6c9d2bc8f91b89624add29c0abeae7fb42bf539fa1cdb2e3e57cd668fa9bcead")&&(e=await sE(r.error.bind(r))),e}async function aC(o,r){let e=o.getItem(pm);return typeof e!="string"&&(e=await aE(r.error.bind(r))),e}async function FI(o,r){let e=o.getItem(cu);return typeof e!="string"&&(e=await gh(r.error.bind(r))),e}var lC=w(()=>{Y();Nu();ir()});async function cC(o,r){r.trace("Resolving machine identifier...");let e=await sC(o,r);return o.setItem(um,e),r.trace(`Resolved machine identifier: ${e}`),e}async function dC(o,r){r.trace("Resolving SQM identifier...");let e=await aC(o,r);return o.setItem(pm,e),r.trace(`Resolved SQM identifier: ${e}`),e}async function uC(o,r){r.trace("Resolving devDevice identifier...");let e=await FI(o,r);return o.setItem(cu,e),r.trace(`Resolved devDevice identifier: ${e}`),e}async function pC(o,r){let e=await gh(r.error.bind(r)),t=await FI(o,r);e!==t&&o.setItem(cu,e)}var fC=w(()=>{Nu();ir();lC()});var yc,mC=w(()=>{re();Yn();Xn();ep();je();qr();se();yc=class extends pc{constructor(r,e,t,n,i){super(b.file(r.extensionsPath),e,t,n,i)}};yc=T([g(0,fr),g(1,ke),g(2,_r),g(3,Dt),g(4,O)],yc)});var Yh,hC=w(()=>{Lr();se();re();Yh=class{constructor(r){this.loggerService=r;this.loggers=new gt}listen(r,e,t){switch(e){case"onDidChangeLoggers":return t?this.loggerService.getOnDidChangeLoggersEvent(t):this.loggerService.onDidChangeLoggers;case"onDidChangeLogLevel":return t?this.loggerService.getOnDidChangeLogLevelEvent(t):this.loggerService.onDidChangeLogLevel;case"onDidChangeVisibility":return t?this.loggerService.getOnDidChangeVisibilityEvent(t):this.loggerService.onDidChangeVisibility}throw new Error(`Event not found: ${e}`)}async call(r,e,t){switch(e){case"createLogger":this.createLogger(b.revive(t[0]),t[1],t[2]);return;case"log":return this.log(b.revive(t[0]),t[1]);case"consoleLog":return this.consoleLog(t[0],t[1]);case"setLogLevel":return tu(t[0])?this.loggerService.setLogLevel(t[0]):this.loggerService.setLogLevel(b.revive(t[0]),t[1]);case"setVisibility":return this.loggerService.setVisibility(b.revive(t[0]),t[1]);case"registerLogger":return this.loggerService.registerLogger({...t[0],resource:b.revive(t[0].resource)},t[1]);case"deregisterLogger":return this.loggerService.deregisterLogger(b.revive(t[0]))}throw new Error(`Call not found: ${e}`)}createLogger(r,e,t){this.loggers.set(r,this.loggerService.createLogger(r,e,t))}consoleLog(r,e){let t=console.log;switch(r){case 5:t=console.error;break;case 4:t=console.warn;break;case 3:t=console.info;break}t.call(console,...e)}log(r,e){let t=this.loggers.get(r);if(!t)throw new Error("Create the logger before logging");for(let[n,i]of e)nu(t,n,i)}}});var UI,wc,rp,gC=w(()=>{K();Z();re();Wt();Js();ir();yi();Q();he();xt();UI=W("utilityProcessWorker"),wc=class extends C{constructor(e,t,n,i){super();this.logService=e;this.windowsMainService=t;this.telemetryService=n;this.lifecycleMainService=i;this.workers=new Map}async createWorker(e){let t=`window: ${e.reply.windowId}, moduleId: ${e.process.moduleId}`;this.logService.trace(`[UtilityProcessWorker]: createWorker(${t})`);let n=this.hash(e);this.workers.has(n)&&(this.logService.warn(`[UtilityProcessWorker]: createWorker() found an existing worker that will be terminated (${t})`),this.disposeWorker(e));let i=new rp(this.logService,this.windowsMainService,this.telemetryService,this.lifecycleMainService,e);if(!i.spawn())return{reason:{code:1,signal:"EINVALID"}};this.workers.set(n,i);let s=new Gt;return E.once(i.onDidTerminate)(a=>{a.code===0?this.logService.trace(`[UtilityProcessWorker]: terminated normally with code ${a.code}, signal: ${a.signal}`):this.logService.error(`[UtilityProcessWorker]: terminated unexpectedly with code ${a.code}, signal: ${a.signal}`),this.workers.delete(n),s.complete({reason:a})}),s.p}hash(e){return rr({moduleId:e.process.moduleId,windowId:e.reply.windowId})}async disposeWorker(e){let t=this.hash(e),n=this.workers.get(t);n&&(this.logService.trace(`[UtilityProcessWorker]: disposeWorker(window: ${e.reply.windowId}, moduleId: ${e.process.moduleId})`),n.kill(),n.dispose(),this.workers.delete(t))}};wc=T([g(0,O),g(1,Le),g(2,ot),g(3,me)],wc);rp=class extends C{constructor(e,t,n,i,s){super();this.windowsMainService=t;this.configuration=s;this._onDidTerminate=this._register(new x);this.onDidTerminate=this._onDidTerminate.event;this.utilityProcess=this._register(new Jo(e,t,n,i)),this.registerListeners()}registerListeners(){this._register(this.utilityProcess.onExit(e=>this._onDidTerminate.fire({code:e.code,signal:e.signal}))),this._register(this.utilityProcess.onCrash(e=>this._onDidTerminate.fire({code:e.code,signal:"ECRASH"})))}spawn(){let t=this.windowsMainService.getWindowById(this.configuration.reply.windowId)?.win?.webContents.getOSProcessId();return this.utilityProcess.start({type:this.configuration.process.type,name:this.configuration.process.name,entryPoint:this.configuration.process.moduleId,parentLifecycleBound:t,windowLifecycleBound:!0,correlationId:`${this.configuration.reply.windowId}`,responseWindowId:this.configuration.reply.windowId,responseChannel:this.configuration.reply.channel,responseNonce:this.configuration.reply.nonce})}kill(){this.utilityProcess.kill()}};rp=T([g(0,O),g(1,Le),g(2,ot),g(3,me)],rp)});var vC,yC=w(()=>{vC="utilityProcessWorker"});var Fme,EA,NI,BI,Ume,Ic=w(()=>{Z();jn();Fme=W("ptyService"),EA={Backend:"workbench.contributions.terminal.processBackend"},NI=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(r){let e=this._sanitizeRemoteAuthority(r.remoteAuthority);if(this._backends.has(e))throw new Error(`A terminal backend with remote authority '${e}' was already registered.`);this._backends.set(e,r)}getTerminalBackend(r){return this._backends.get(this._sanitizeRemoteAuthority(r))}_sanitizeRemoteAuthority(r){return r?.toLowerCase()??""}};Tt.add(EA.Backend,new NI);BI=W("localPtyService"),Ume=W("terminalLogService")});var bc,wC=w(()=>{Ot();Bf();xt();re();cs();Ic();Js();sy();Qn();K();Q();yn();We();st();ze();bc=class extends C{constructor(e,t,n,i,s){super();this._reconnectConstants=e;this._configurationService=t;this._environmentMainService=n;this._lifecycleMainService=i;this._logService=s;this.utilityProcess=void 0;this._onRequestConnection=this._register(new x);this.onRequestConnection=this._onRequestConnection.event;this._onWillShutdown=this._register(new x);this.onWillShutdown=this._onWillShutdown.event;this._register(this._lifecycleMainService.onWillShutdown(()=>this._onWillShutdown.fire())),ct.on("vscode:createPtyHostMessageChannel",(a,l)=>this._onWindowConnection(a,l)),this._register(j(()=>{ct.removeHandler("vscode:createPtyHostMessageChannel")}))}start(){this.utilityProcess=new or(this._logService,ls,this._lifecycleMainService);let e=Lx(this._environmentMainService.args,this._environmentMainService.isBuilt),t=e.port?["--nolazy",`--inspect${e.break?"-brk":""}=${e.port}`]:void 0;this.utilityProcess.start({type:"ptyHost",name:"pty-host",entryPoint:"vs/platform/terminal/node/ptyHostMain",execArgv:t,args:["--logsPath",this._environmentMainService.logsHome.with({scheme:N.file}).fsPath],env:this._createPtyHostConfiguration()});let n=this.utilityProcess.connect(),i=new tl(n,"ptyHost"),s=new te;return s.add(i),s.add(j(()=>{this.utilityProcess?.kill(),this.utilityProcess?.dispose(),this.utilityProcess=void 0})),{client:i,store:s,onDidProcessExit:this.utilityProcess.onExit}}_createPtyHostConfiguration(){this._environmentMainService.unsetSnapExportedVariables();let e={...gr(process.env),VSCODE_ESM_ENTRYPOINT:"vs/platform/terminal/node/ptyHostMain",VSCODE_PIPE_LOGGING:"true",VSCODE_VERBOSE_LOGGING:"true",VSCODE_RECONNECT_GRACE_TIME:String(this._reconnectConstants.graceTime),VSCODE_RECONNECT_SHORT_GRACE_TIME:String(this._reconnectConstants.shortGraceTime),VSCODE_RECONNECT_SCROLLBACK:String(this._reconnectConstants.scrollback)},t=this._configurationService.getValue("terminal.integrated.developer.ptyHost.latency");t&&Hn(t)&&(e.VSCODE_LATENCY=String(t));let n=this._configurationService.getValue("terminal.integrated.developer.ptyHost.startupDelay");return n&&Hn(n)&&(e.VSCODE_STARTUP_DELAY=String(n)),this._environmentMainService.restoreSnapExportedVariables(),e}_onWindowConnection(e,t){this._onRequestConnection.fire();let n=this.utilityProcess.connect();if(e.sender.isDestroyed()){n.close();return}e.sender.postMessage("vscode:createPtyHostMessageChannelResult",t,[n])}};bc=T([g(1,ge),g(2,Te),g(3,me),g(4,O)],bc)});var eg,IC=w(()=>{se();Q();re();K();eg=class extends C{constructor(r,e){super(),e.call("setLogLevel",[r.getLogLevel()]),this._register(r.onDidChangeLogLevel(t=>e.call("setLogLevel",[t]))),e.call("getRegisteredLoggers").then(t=>{for(let n of t)r.registerLogger({...n,resource:b.revive(n.resource)})}),this._register(e.listen("onDidChangeVisibility")(([t,n])=>r.setVisibility(b.revive(t),n))),this._register(e.listen("onDidChangeLoggers")(({added:t,removed:n})=>{for(let i of t)r.registerLogger({...i,resource:b.revive(i.resource)});for(let i of n)r.deregisterLogger(i.resource)}))}}});var Sc,bC=w(()=>{he();St();Q();K();re();Sc=class extends C{constructor(e,t){super();this._logService=t;this._lastRequestId=0;this._pendingRequests=new Map;this._pendingRequestDisposables=new Map;this._onCreateRequest=this._register(new x);this.onCreateRequest=this._onCreateRequest.event;this._timeout=e===void 0?15e3:e,this._register(j(()=>{for(let n of this._pendingRequestDisposables.values())pt(n)}))}createRequest(e){return new Promise((t,n)=>{let i=++this._lastRequestId;this._pendingRequests.set(i,t),this._onCreateRequest.fire({requestId:i,...e});let s=new qe;lt(this._timeout,s.token).then(()=>n(`Request ${i} timed out (${this._timeout}ms)`)),this._pendingRequestDisposables.set(i,[j(()=>s.cancel())])})}acceptReply(e,t){let n=this._pendingRequests.get(e);n?(this._pendingRequests.delete(e),pt(this._pendingRequestDisposables.get(e)||[]),this._pendingRequestDisposables.delete(e),n(t)):this._logService.warn(`RequestStore#acceptReply was called without receiving a matching request ${e}`)}};Sc=T([g(1,O)],Sc)});function SC(o,r){let e=[{name:null,description:h(2349,null)}];return e.push(...o.map(t=>({name:t.profileName,description:TA(t)}))),r&&e.push(...r.map(t=>({name:t.title,description:CA(t)}))),{values:e.map(t=>t.name),markdownDescriptions:e.map(t=>t.description)}}function TA(o){let r=`$(${sc.isThemeIcon(o.icon)?o.icon.id:o.icon?o.icon:mt.terminal.id}) ${o.profileName}
- path: ${o.path}`;return o.args&&(Ae(o.args)?r+=`
- args: "${o.args}"`:r+=`
- args: [${o.args.length===0?"":`'${o.args.join("','")}'`}]`),o.overrideName!==void 0&&(r+=`
- overrideName: ${o.overrideName}`),o.color&&(r+=`
- color: ${o.color}`),o.env&&(r+=`
- env: ${JSON.stringify(o.env)}`),r}function CA(o){return`$(${sc.isThemeIcon(o.icon)?o.icon.id:o.icon?o.icon:mt.terminal.id}) ${o.title}
- extensionIdentifier: ${o.extensionIdentifier}`}var xC=w(()=>{Qu();se();Ce();xI();We()});function KI(o){let r=o===2?"linux":o===1?"osx":"windows";return h(2328,null,Rp(o),'```json\n"terminal.integrated.profile.'+r+'": {\n  "bash": null\n}\n```',"[","](https://code.visualstudio.com/docs/terminal/profiles)")}function PC(){Tt.as(tr.Configuration).registerConfiguration(RA),DA()}function DA(o,r){let e=Tt.as(tr.Configuration),t;o&&(t=SC(o?.profiles,r));let n=$I;$I={id:"terminal",order:100,title:h(2332,null),type:"object",properties:{"terminal.integrated.defaultProfile.linux":{restricted:!0,markdownDescription:h(2323,null),type:["string","null"],default:null,enum:o?.os===3?t?.values:void 0,markdownEnumDescriptions:o?.os===3?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.osx":{restricted:!0,markdownDescription:h(2324,null),type:["string","null"],default:null,enum:o?.os===2?t?.values:void 0,markdownEnumDescriptions:o?.os===2?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.windows":{restricted:!0,markdownDescription:h(2325,null),type:["string","null"],default:null,enum:o?.os===1?t?.values:void 0,markdownEnumDescriptions:o?.os===1?t?.markdownDescriptions:void 0}}},e.updateConfigurations({add:[$I],remove:n?[n]:[]})}var _A,kA,xc,VI,HI,RA,$I,EC=w(()=>{Qu();Y();Ce();Gi();jn();Ic();xC();_A={type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"],default:null},kA={type:"string",enum:Array.from(SI(),o=>o.id),markdownEnumDescriptions:Array.from(SI(),o=>`$(${o.id})`)},xc={args:{description:h(2333,null),type:"array",items:{type:"string"}},icon:{description:h(2336,null),...kA},color:{description:h(2334,null),..._A},env:{markdownDescription:h(2335,null),type:"object",additionalProperties:{type:["string","null"]},default:{}}},VI={type:"object",required:["path"],properties:{path:{description:h(2344,null),type:["string","array"],items:{type:"string"}},overrideName:{description:h(2343,null),type:"boolean"},...xc}},HI={type:"object",required:["path"],properties:{path:{description:h(2331,null),type:["string"],items:{type:"string"}},...xc}};RA={id:"terminal",order:100,title:h(2332,null),type:"object",properties:{"terminal.integrated.automationProfile.linux":{restricted:!0,markdownDescription:h(2319,null),type:["object","null"],default:null,anyOf:[{type:"null"},HI],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.osx":{restricted:!0,markdownDescription:h(2320,null),type:["object","null"],default:null,anyOf:[{type:"null"},HI],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.windows":{restricted:!0,markdownDescription:h(2321,null,"`terminal.integrated.automationShell.windows`"),type:["object","null"],default:null,anyOf:[{type:"null"},HI],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.profiles.windows":{restricted:!0,markdownDescription:KI(3),type:"object",default:{PowerShell:{source:"PowerShell",icon:mt.terminalPowershell.id},"Command Prompt":{path:["${env:windir}\\Sysnative\\cmd.exe","${env:windir}\\System32\\cmd.exe"],args:[],icon:mt.terminalCmd.id},"Git Bash":{source:"Git Bash",icon:mt.terminalGitBash.id}},additionalProperties:{anyOf:[{type:"object",required:["source"],properties:{source:{description:h(2348,null),enum:["PowerShell","Git Bash"]},...xc}},{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:h(2346,null),type:"string"},id:{description:h(2345,null),type:"string"},title:{description:h(2347,null),type:"string"},...xc}},{type:"null"},VI]}},"terminal.integrated.profiles.osx":{restricted:!0,markdownDescription:KI(1),type:"object",default:{bash:{path:"bash",args:["-l"],icon:mt.terminalBash.id},zsh:{path:"zsh",args:["-l"]},fish:{path:"fish",args:["-l"]},tmux:{path:"tmux",icon:mt.terminalTmux.id},pwsh:{path:"pwsh",icon:mt.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:h(2341,null),type:"string"},id:{description:h(2340,null),type:"string"},title:{description:h(2342,null),type:"string"},...xc}},{type:"null"},VI]}},"terminal.integrated.profiles.linux":{restricted:!0,markdownDescription:KI(2),type:"object",default:{bash:{path:"bash",icon:mt.terminalBash.id},zsh:{path:"zsh"},fish:{path:"fish"},tmux:{path:"tmux",icon:mt.terminalTmux.id},pwsh:{path:"pwsh",icon:mt.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:h(2338,null),type:"string"},id:{description:h(2337,null),type:"string"},title:{description:h(2339,null),type:"string"},...xc}},{type:"null"},VI]}},"terminal.integrated.useWslProfiles":{description:h(2330,null),type:"boolean",default:!0},"terminal.integrated.inheritEnv":{scope:1,description:h(2326,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionScrollback":{scope:1,markdownDescription:h(2327,null),type:"number",default:100},"terminal.integrated.showLinkHover":{scope:1,description:h(2329,null),type:"boolean",default:!0},"terminal.integrated.ignoreProcessNames":{markdownDescription:h(2322,null,"`#terminal.integrated.confirmOnKill#`"),type:"array",items:{type:"string",uniqueItems:!0},default:["starship","oh-my-posh","bash","zsh"]}}}});import*as _C from"fs";import*as kC from"child_process";function RC(o,r,e,t,n=process.env,i,s,a,l){return i=i||{existsFile:Yt.existsFile,readFile:_C.promises.readFile},M?WA(e,i,n,s,t.getValue("terminal.integrated.useWslProfiles")!==!1,o&&Je(o)?{...o}:t.getValue("terminal.integrated.profiles.windows"),Ae(r)?r:t.getValue("terminal.integrated.defaultProfile.windows"),l,a):NA(i,s,e,o&&Je(o)?{...o}:t.getValue(ne?"terminal.integrated.profiles.linux":"terminal.integrated.profiles.osx"),Ae(r)?r:t.getValue(ne?"terminal.integrated.defaultProfile.linux":"terminal.integrated.defaultProfile.osx"),l,a,n)}async function WA(o,r,e,t,n,i,s,a,l){let c=process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432"),d=`${process.env.windir}\\${c?"Sysnative":"System32"}`,u=await Wf()>=19041;await AA(a);let f=new Map;if(o){f.set("PowerShell",{source:"PowerShell",icon:mt.terminalPowershell,isAutoDetected:!0}),f.set("Windows PowerShell",{path:`${d}\\WindowsPowerShell\\v1.0\\powershell.exe`,icon:mt.terminalPowershell,isAutoDetected:!0}),f.set("Git Bash",{source:"Git Bash",icon:mt.terminalGitBash,isAutoDetected:!0}),f.set("Command Prompt",{path:`${d}\\cmd.exe`,icon:mt.terminalCmd,isAutoDetected:!0}),f.set("Cygwin",{path:[{path:`${process.env.HOMEDRIVE}\\cygwin64\\bin\\bash.exe`,isUnsafe:!0},{path:`${process.env.HOMEDRIVE}\\cygwin\\bin\\bash.exe`,isUnsafe:!0}],args:["--login"],isAutoDetected:!0}),f.set("bash (MSYS2)",{path:[{path:`${process.env.HOMEDRIVE}\\msys64\\usr\\bin\\bash.exe`,isUnsafe:!0}],args:["--login","-i"],env:{CHERE_INVOKING:"1"},icon:mt.terminalBash,isAutoDetected:!0});let y=`${process.env.CMDER_ROOT||`${process.env.HOMEDRIVE}\\cmder`}\\vendor\\bin\\vscode_init.cmd`;f.set("Cmder",{path:`${d}\\cmd.exe`,args:["/K",y],requiresPath:process.env.CMDER_ROOT?y:{path:y,isUnsafe:!0},isAutoDetected:!0})}WC(i,f);let m=await DC(f.entries(),s,r,e,t,l);if(o&&n&&u)try{let y=await FA(`${d}\\wsl.exe`,s);for(let v of y)(!i||!Object.prototype.hasOwnProperty.call(i,v.profileName))&&m.push(v)}catch{TC&&(t?.trace("WSL is not installed, so could not detect WSL profiles"),TC=!1)}return m}async function DC(o,r,e,t=process.env,n,i){let s=[];for(let[a,l]of o)s.push(LA(a,l,r,e,t,n,i));return(await Promise.all(s)).filter(a=>!!a)}async function LA(o,r,e,t,n=process.env,i,s){if(r===null)return;let a,l,c;if(Tn(r,{source:!0})){let m=np?.get(r.source);if(!m)return;a=m.paths,l=r.args||m.args,r.icon?c=CC(r.icon):m.icon&&(c=m.icon)}else a=Array.isArray(r.path)?r.path:[r.path],l=M||Array.isArray(r.args)?r.args:void 0,c=CC(r.icon);let d;if(s){let m=a.map(v=>Ae(v)?v:v.path),y=await s(m);d=new Array(a.length);for(let v=0;v<a.length;v++)Ae(a[v])?d[v]=y[v]:d[v]={path:y[v],isUnsafe:!0}}else d=a.slice();let u;if(r.requiresPath){let m;if(Ae(r.requiresPath)?m=r.requiresPath:(m=r.requiresPath.path,r.requiresPath.isUnsafe&&(u=m)),!await t.existsFile(m))return}let f=await tg(o,e,d,t,n,l,r.env,r.overrideName,r.isAutoDetected,u);if(!f){i?.debug("Terminal profile not validated",o,a);return}return f.isAutoDetected=r.isAutoDetected,f.icon=c,f.color=r.color,f}function CC(o){return Ae(o)?{id:o}:o}async function AA(o){if(np&&!o)return;let[r,e]=await Promise.all([MA(),o||OA()]);np=new Map,np.set("Git Bash",{profileName:"Git Bash",paths:r,args:["--login","-i"]}),np.set("PowerShell",{profileName:"PowerShell",paths:e,icon:mt.terminalPowershell})}async function MA(){let o=new Set,r=await Du("git.exe");if(r){let n=$e(r);o.add(It(n,"../.."))}function e(n,i){i&&n.add(i)}e(o,process.env.ProgramW6432),e(o,process.env.ProgramFiles),e(o,process.env["ProgramFiles(X86)"]),e(o,`${process.env.LocalAppData}\\Program`);let t=[];for(let n of o)t.push(`${n}\\Git\\bin\\bash.exe`,`${n}\\Git\\usr\\bin\\bash.exe`,`${n}\\usr\\bin\\bash.exe`);return t.push(`${process.env.UserProfile}\\scoop\\apps\\git\\current\\bin\\bash.exe`),t.push(`${process.env.UserProfile}\\scoop\\apps\\git-with-openssh\\current\\bin\\bash.exe`),t}async function OA(){let o=[];for await(let r of ww())o.push(r.exePath);return o}async function FA(o,r){let e=[],t=await new Promise((i,s)=>{kC.exec("wsl.exe -l -q",{encoding:"utf16le",env:{...process.env,WSL_UTF8:"0"},timeout:1e3},(a,l)=>{if(a)return s("Problem occurred when getting wsl distros");i(l)})});if(!t)return[];let n=t.split(/\r?\n/).filter(i=>i.trim().length>0);for(let i of n){if(i===""||i.startsWith("docker-desktop"))continue;let s=`${i} (WSL)`,a={profileName:s,path:o,args:["-d",`${i}`],isDefault:s===r,icon:UA(i),isAutoDetected:!1};e.push(a)}return e}function UA(o){return o.includes("Ubuntu")?mt.terminalUbuntu:o.includes("Debian")?mt.terminalDebian:mt.terminalLinux}async function NA(o,r,e,t,n,i,s,a){let l=new Map;if(e&&await o.existsFile("/etc/shells")){let c=(await o.readFile("/etc/shells")).toString(),d=(i||c.split(`
`)).map(f=>{let m=f.indexOf("#");return m===-1?f:f.substring(0,m)}).filter(f=>f.trim().length>0),u=new Map;for(let f of d){let m=ye(f),y=u.get(m)||0;y++,y>1&&(m=`${m} (${y})`),u.set(m,y),l.set(m,{path:f,isAutoDetected:!0})}}return WC(t,l),await DC(l.entries(),n,o,a,r,s)}function WC(o,r){if(o)for(let[e,t]of Object.entries(o))t===null||!Je(t)||!Tn(t,{path:!0})&&!Tn(t,{source:!0})?r.delete(e):(t.icon=t.icon||r.get(e)?.icon,r.set(e,t))}async function tg(o,r,e,t,n,i,s,a,l,c){if(e.length===0)return Promise.resolve(void 0);let d=e.shift();if(d==="")return tg(o,r,e,t,n,i,s,a,l);let u=!Ae(d)&&d.isUnsafe,f=Ae(d)?d:d.path,m={profileName:o,path:f,args:i,env:s,overrideName:a,isAutoDetected:l,isDefault:o===r,isUnsafePath:u,requiresUnsafePath:c};if(ye(f)===f){let v=n.PATH?n.PATH.split(Fp):void 0,S=await Du(f,void 0,v,void 0,t.existsFile);return S?(m.path=S,m.isFromPath=!0,m):tg(o,r,e,t,n,i)}return await t.existsFile(kt(f))?m:tg(o,r,e,t,n,i,s,a,l)}var np,TC,LC=w(()=>{Qu();Se();Y();Ul();We();jt();Iw();Ic();el();TC=!0});var Pc,AC=w(()=>{Q();K();Y();vi();st();re();IC();zm();bC();Ic();EC();LC();Pw();xs();Pc=class extends C{constructor(e,t,n,i){super();this._ptyHostStarter=e;this._configurationService=t;this._logService=n;this._loggerService=i;this._wasQuitRequested=!1;this._restartCount=0;this._isResponsive=!0;this._onPtyHostExit=this._register(new x);this.onPtyHostExit=this._onPtyHostExit.event;this._onPtyHostStart=this._register(new x);this.onPtyHostStart=this._onPtyHostStart.event;this._onPtyHostUnresponsive=this._register(new x);this.onPtyHostUnresponsive=this._onPtyHostUnresponsive.event;this._onPtyHostResponsive=this._register(new x);this.onPtyHostResponsive=this._onPtyHostResponsive.event;this._onPtyHostRequestResolveVariables=this._register(new x);this.onPtyHostRequestResolveVariables=this._onPtyHostRequestResolveVariables.event;this._onProcessData=this._register(new x);this.onProcessData=this._onProcessData.event;this._onProcessReady=this._register(new x);this.onProcessReady=this._onProcessReady.event;this._onProcessReplay=this._register(new x);this.onProcessReplay=this._onProcessReplay.event;this._onProcessOrphanQuestion=this._register(new x);this.onProcessOrphanQuestion=this._onProcessOrphanQuestion.event;this._onDidRequestDetach=this._register(new x);this.onDidRequestDetach=this._onDidRequestDetach.event;this._onDidChangeProperty=this._register(new x);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new x);this.onProcessExit=this._onProcessExit.event;PC(),this._register(this._ptyHostStarter),this._register(j(()=>this._disposePtyHost())),this._resolveVariablesRequestStore=this._register(new Sc(void 0,this._logService)),this._register(this._resolveVariablesRequestStore.onCreateRequest(this._onPtyHostRequestResolveVariables.fire,this._onPtyHostRequestResolveVariables)),this._ptyHostStarter.onRequestConnection&&this._register(E.once(this._ptyHostStarter.onRequestConnection)(()=>this._ensurePtyHost())),this._ptyHostStarter.onWillShutdown&&this._register(this._ptyHostStarter.onWillShutdown(()=>this._wasQuitRequested=!0))}get _connection(){return this._ensurePtyHost(),this.__connection}get _proxy(){return this._ensurePtyHost(),this.__proxy}get _optionalProxy(){return this.__proxy}_ensurePtyHost(){this.__connection||this._startPtyHost()}get _ignoreProcessNames(){return this._configurationService.getValue("terminal.integrated.ignoreProcessNames")}async _refreshIgnoreProcessNames(){return this._optionalProxy?.refreshIgnoreProcessNames?.(this._ignoreProcessNames)}async _resolveShellEnv(){if(M)return process.env;try{return await Nl(this._configurationService,this._logService,{_:[]},process.env)}catch(e){return this._logService.error("ptyHost was unable to resolve shell environment",e),{}}}_startPtyHost(){let e=this._ptyHostStarter.start(),t=e.client;this._logService.getLevel()===1&&this._logService.trace("PtyHostService#_startPtyHost",new Error().stack?.replace(/^Error/,"")),He.toService(t.getChannel("heartbeat")).onBeat(()=>this._handleHeartbeat()),this._handleHeartbeat(!0),this._register(e.onDidProcessExit(s=>{this._onPtyHostExit.fire(s.code),!this._wasQuitRequested&&!this._store.isDisposed&&(this._restartCount<=5?(this._logService.error(`ptyHost terminated unexpectedly with code ${s.code}`),this._restartCount++,this.restartPtyHost()):this._logService.error(`ptyHost terminated unexpectedly with code ${s.code}, giving up`))}));let i=He.toService(t.getChannel("ptyHost"));return this._register(i.onProcessData(s=>this._onProcessData.fire(s))),this._register(i.onProcessReady(s=>this._onProcessReady.fire(s))),this._register(i.onProcessExit(s=>this._onProcessExit.fire(s))),this._register(i.onDidChangeProperty(s=>this._onDidChangeProperty.fire(s))),this._register(i.onProcessReplay(s=>this._onProcessReplay.fire(s))),this._register(i.onProcessOrphanQuestion(s=>this._onProcessOrphanQuestion.fire(s))),this._register(i.onDidRequestDetach(s=>this._onDidRequestDetach.fire(s))),this._register(new eg(this._loggerService,t.getChannel("logger"))),this.__connection=e,this.__proxy=i,this._onPtyHostStart.fire(),this._register(this._configurationService.onDidChangeConfiguration(async s=>{s.affectsConfiguration("terminal.integrated.ignoreProcessNames")&&await this._refreshIgnoreProcessNames()})),this._refreshIgnoreProcessNames(),[e,i]}async createProcess(e,t,n,i,s,a,l,c,d,u,f){let m=setTimeout(()=>this._handleUnresponsiveCreateProcess(),5e3),y=await this._proxy.createProcess(e,t,n,i,s,a,l,c,d,u,f);return clearTimeout(m),y}updateTitle(e,t,n){return this._proxy.updateTitle(e,t,n)}updateIcon(e,t,n,i){return this._proxy.updateIcon(e,t,n,i)}attachToProcess(e){return this._proxy.attachToProcess(e)}detachFromProcess(e,t){return this._proxy.detachFromProcess(e,t)}shutdownAll(){return this._proxy.shutdownAll()}listProcesses(){return this._proxy.listProcesses()}async getPerformanceMarks(){return this._optionalProxy?.getPerformanceMarks()??[]}async reduceConnectionGraceTime(){return this._optionalProxy?.reduceConnectionGraceTime()}start(e){return this._proxy.start(e)}shutdown(e,t){return this._proxy.shutdown(e,t)}input(e,t){return this._proxy.input(e,t)}sendSignal(e,t){return this._proxy.sendSignal(e,t)}processBinary(e,t){return this._proxy.processBinary(e,t)}resize(e,t,n,i,s){return this._proxy.resize(e,t,n,i,s)}clearBuffer(e){return this._proxy.clearBuffer(e)}acknowledgeDataEvent(e,t){return this._proxy.acknowledgeDataEvent(e,t)}setUnicodeVersion(e,t){return this._proxy.setUnicodeVersion(e,t)}setNextCommandId(e,t,n){return this._proxy.setNextCommandId(e,t,n)}getInitialCwd(e){return this._proxy.getInitialCwd(e)}getCwd(e){return this._proxy.getCwd(e)}async getLatency(){let e=new sn,t=await this._proxy.getLatency();return e.stop(),[{label:"ptyhostservice<->ptyhost",latency:e.elapsed()},...t]}orphanQuestionReply(e){return this._proxy.orphanQuestionReply(e)}installAutoReply(e,t){return this._proxy.installAutoReply(e,t)}uninstallAllAutoReplies(){return this._proxy.uninstallAllAutoReplies()}getDefaultSystemShell(e){return this._optionalProxy?.getDefaultSystemShell(e)??qm(e??Lt,process.env)}async getProfiles(e,t,n,i=!1){let s=await this._resolveShellEnv();return RC(t,n,i,this._configurationService,s,void 0,this._logService,this._resolveVariables.bind(this,e))}async getEnvironment(){return this.__proxy?this._proxy.getEnvironment():{...process.env}}getWslPath(e,t){return this._proxy.getWslPath(e,t)}getRevivedPtyNewId(e,t){return this._proxy.getRevivedPtyNewId(e,t)}setTerminalLayoutInfo(e){return this._proxy.setTerminalLayoutInfo(e)}async getTerminalLayoutInfo(e){return this._optionalProxy?.getTerminalLayoutInfo(e)}async requestDetachInstance(e,t){return this._proxy.requestDetachInstance(e,t)}async acceptDetachInstanceReply(e,t){return this._proxy.acceptDetachInstanceReply(e,t)}async freePortKillProcess(e){if(!this._proxy.freePortKillProcess)throw new Error("freePortKillProcess does not exist on the pty proxy");return this._proxy.freePortKillProcess(e)}async serializeTerminalState(e){return this._proxy.serializeTerminalState(e)}async reviveTerminalProcesses(e,t,n){return this._proxy.reviveTerminalProcesses(e,t,n)}async refreshProperty(e,t){return this._proxy.refreshProperty(e,t)}async updateProperty(e,t,n){return this._proxy.updateProperty(e,t,n)}async restartPtyHost(){this._disposePtyHost(),this._isResponsive=!0,this._startPtyHost()}_disposePtyHost(){this._proxy.shutdownAll(),this._connection.store.dispose()}_handleHeartbeat(e){this._clearHeartbeatTimeouts(),this._heartbeatFirstTimeout=setTimeout(()=>this._handleHeartbeatFirstTimeout(),e?2e4:5e3*1.2),this._isResponsive||(this._isResponsive=!0,this._onPtyHostResponsive.fire())}_handleHeartbeatFirstTimeout(){this._logService.warn(`No ptyHost heartbeat after ${5e3*1.2/1e3} seconds`),this._heartbeatFirstTimeout=void 0,this._heartbeatSecondTimeout=setTimeout(()=>this._handleHeartbeatSecondTimeout(),5e3*1)}_handleHeartbeatSecondTimeout(){this._logService.error(`No ptyHost heartbeat after ${(5e3*1.2+5e3*1.2)/1e3} seconds`),this._heartbeatSecondTimeout=void 0,this._isResponsive&&(this._isResponsive=!1,this._onPtyHostUnresponsive.fire())}_handleUnresponsiveCreateProcess(){this._clearHeartbeatTimeouts(),this._logService.error(`No ptyHost response to createProcess after ${5e3/1e3} seconds`),this._isResponsive&&(this._isResponsive=!1,this._onPtyHostUnresponsive.fire())}_clearHeartbeatTimeouts(){this._heartbeatFirstTimeout&&(clearTimeout(this._heartbeatFirstTimeout),this._heartbeatFirstTimeout=void 0),this._heartbeatSecondTimeout&&(clearTimeout(this._heartbeatSecondTimeout),this._heartbeatSecondTimeout=void 0)}_resolveVariables(e,t){return this._resolveVariablesRequestStore.createRequest({workspaceId:e,originalText:t})}async acceptPtyHostResolvedVariables(e,t){this._resolveVariablesRequestStore.acceptReply(e,t)}};Pc=T([g(1,ge),g(2,O),g(3,Fo)],Pc)});var qI,MC,rg,OC=w(()=>{qI="request",MC="remoteResourceHandler",rg=class{async routeCall(r,e,t){if(e!==qI)throw new Error(`Call not found: ${e}`);let n=Array.isArray(t)?t[0]:void 0;if(n?.authority){let i=r.connections.find(s=>s.ctx===n.authority);if(i)return i}throw new Error("Caller not found")}routeEvent(r,e){throw new Error(`Event not found: ${e}`)}}});import{BrowserWindow as VA}from"electron";var Ec,FC=w(()=>{Y();st();Ot();xt();re();Jr();no();xi();TI();Ec=class extends Xu{constructor(e,t,n,i,s,a){super(i,s,t,n);this.webContents=e;this.lifecycleMainService=a;this.parentId=-1;this.stateApplied=!1;this.id=this.webContents.id,this.tryClaimWindow()}get win(){return super.win||this.tryClaimWindow(),super.win}tryClaimWindow(e){this._store.isDisposed||this.webContents.isDestroyed()||(this.doTryClaimWindow(e),e&&!this.stateApplied&&(this.stateApplied=!0,this.applyState({x:e.x,y:e.y,width:e.width,height:e.height,mode:e.show===!1?0:1})))}doTryClaimWindow(e){if(this._win)return;let t=VA.fromWebContents(this.webContents);t&&(this.logService.trace("[aux window] Claimed browser window instance"),this.setWin(t,e),t.setMenu(null),(M||ne)&&Bo(this.configurationService,e?.titleBarStyle==="hidden"?"custom":void 0)&&t.setAutoHideMenuBar(!0),this.lifecycleMainService.registerAuxWindow(this))}matches(e){return this.webContents.id===e.id}};Ec=T([g(1,Te),g(2,O),g(3,ge),g(4,ft),g(5,me)],Ec)});import{BrowserWindow as HA,app as KA}from"electron";var Tc,UC=w(()=>{Q();K();ze();Qn();FC();Z();re();xi();Wt();Tc=class extends C{constructor(e,t){super();this.instantiationService=e;this.logService=t;this._onDidMaximizeWindow=this._register(new x);this.onDidMaximizeWindow=this._onDidMaximizeWindow.event;this._onDidUnmaximizeWindow=this._register(new x);this.onDidUnmaximizeWindow=this._onDidUnmaximizeWindow.event;this._onDidChangeFullScreen=this._register(new x);this.onDidChangeFullScreen=this._onDidChangeFullScreen.event;this._onDidChangeAlwaysOnTop=this._register(new x);this.onDidChangeAlwaysOnTop=this._onDidChangeAlwaysOnTop.event;this._onDidTriggerSystemContextMenu=this._register(new x);this.onDidTriggerSystemContextMenu=this._onDidTriggerSystemContextMenu.event;this.windows=new Map;this.registerListeners()}registerListeners(){KA.on("browser-window-created",(e,t)=>{let n=this.getWindowByWebContents(t.webContents);if(n)this.logService.trace('[aux window] app.on("browser-window-created"): Trying to claim auxiliary window'),n.tryClaimWindow();else{let i=new te;i.add(E.fromNodeEventEmitter(t.webContents,"did-create-window",(s,a)=>({browserWindow:s,details:a}))(({browserWindow:s,details:a})=>{let l=this.getWindowByWebContents(s.webContents);l&&(this.logService.trace('[aux window] window.on("did-create-window"): Trying to claim auxiliary window'),l.tryClaimWindow(a.options))})),i.add(E.fromNodeEventEmitter(t,"closed")(()=>i.dispose()))}}),ct.handle("vscode:registerAuxiliaryWindow",async(e,t)=>{let n=this.getWindowByWebContents(e.sender);return n&&(this.logService.trace("[aux window] vscode:registerAuxiliaryWindow: Registering auxiliary window to main window"),n.parentId=t),e.sender.id})}createWindow(e){let{state:t,overrides:n}=this.computeWindowStateAndOverrides(e);return this.instantiationService.invokeFunction(fl,t,n,{preload:et.asFileUri("vs/base/parts/sandbox/electron-browser/preload-aux.js").fsPath})}computeWindowStateAndOverrides(e){let t={},n={},i=e.features.split(",");for(let a of i){let[l,c]=a.split("=");switch(l){case"width":t.width=parseInt(c,10);break;case"height":t.height=parseInt(c,10);break;case"left":t.x=parseInt(c,10);break;case"top":t.y=parseInt(c,10);break;case"window-maximized":t.mode=0;break;case"window-fullscreen":t.mode=3;break;case"window-disable-fullscreen":n.disableFullscreen=!0;break;case"window-native-titlebar":n.forceNativeTitlebar=!0;break;case"window-always-on-top":n.alwaysOnTop=!0;break}}let s=ml.validateWindowState(this.logService,t)??tP();return this.logService.trace("[aux window] using window state",s),{state:s,overrides:n}}registerWindow(e){let t=new te,n=this.instantiationService.createInstance(Ec,e);this.windows.set(n.id,n),t.add(j(()=>this.windows.delete(n.id))),t.add(n.onDidMaximize(()=>this._onDidMaximizeWindow.fire(n))),t.add(n.onDidUnmaximize(()=>this._onDidUnmaximizeWindow.fire(n))),t.add(n.onDidEnterFullScreen(()=>this._onDidChangeFullScreen.fire({window:n,fullscreen:!0}))),t.add(n.onDidLeaveFullScreen(()=>this._onDidChangeFullScreen.fire({window:n,fullscreen:!1}))),t.add(n.onDidChangeAlwaysOnTop(i=>this._onDidChangeAlwaysOnTop.fire({window:n,alwaysOnTop:i}))),t.add(n.onDidTriggerSystemContextMenu(({x:i,y:s})=>this._onDidTriggerSystemContextMenu.fire({window:n,x:i,y:s}))),E.once(n.onDidClose)(()=>t.dispose())}getWindowByWebContents(e){let t=this.windows.get(e.id);return t?.matches(e)?t:void 0}getFocusedWindow(){let e=HA.getFocusedWindow();if(e)return this.getWindowByWebContents(e.webContents)}getLastActiveWindow(){return dm(Array.from(this.windows.values()))}getWindows(){return Array.from(this.windows.values())}};Tc=T([g(0,Vt),g(1,O)],Tc)});var zI,NC,BC=w(()=>{Z();zI=W("INativeMcpDiscoveryHelperService"),NC="NativeMcpDiscoveryHelper"});import{homedir as $A}from"os";var ng,VC=w(()=>{Y();se();ng=class{constructor(){}load(){return Promise.resolve({platform:Ni,homedir:b.file($A()),winAppData:this.uriFromEnvVariable("APPDATA"),xdgHome:this.uriFromEnvVariable("XDG_CONFIG_HOME")})}uriFromEnvVariable(r){let e=process.env[r];if(e)return b.file(e)}}});var ip,HC,KC,GI=w(()=>{Z();ip=W("IMcpGatewayService"),HC="mcpGateway",KC="mcpGatewayToolBroker"});function qA(o){return"method"in o&&"id"in o&&(typeof o.id=="string"||typeof o.id=="number")}function jI(o){return Tn(o,{id:!0,result:!0})||Tn(o,{id:!0,error:!0})}function JI(o){return Tn(o,{method:!0})&&!Tn(o,{id:!0})}function zA(o){return typeof o=="object"&&o!==null&&"then"in o&&typeof o.then=="function"}var pn,Cc,QI=w(()=>{he();St();Ve();K();We();pn=class extends Error{constructor(e,t,n){super(t);this.code=e;this.data=n}},Cc=class o 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=be.None,n){if(this._store.isDisposed)return Promise.reject(new Et);let i=this._nextRequestId++,s=new Gt,a=new qe;this._pendingRequests.set(i,{promise:s,cts:a});let l=t.onCancellationRequested(()=>{s.isSettled||(this._pendingRequests.delete(i),a.cancel(),n?.(i),s.cancel()),l.dispose()});return this._send({jsonrpc:"2.0",id:i,...e}),s.p.finally(()=>{l.dispose(),this._pendingRequests.delete(i),a.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){jI(e)&&(Tn(e,{result:!0})?this._handleResult(e):this._handleError(e)),qA(e)&&await this._handleRequest(e),JI(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 pn(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:o.MethodNotFound,message:`Method not found: ${e.method}`}});return}let t=new qe;this._register(j(()=>t.dispose(!0)));try{let n=this._handlers.handleRequest(e,t.token),i=zA(n)?await n:n;this._send({jsonrpc:"2.0",id:e.id,result:i})}catch(n){n instanceof pn?this._send({jsonrpc:"2.0",id:e.id,error:{code:n.code,message:n.message,data:n.data}}):this._send({jsonrpc:"2.0",id:e.id,error:{code:o.InternalError,message:n instanceof Error?n.message:"Internal error"}})}finally{t.dispose(!0)}}dispose(){this.cancelAllRequests(),super.dispose()}static createParseError(e,t){return{jsonrpc:"2.0",error:{code:o.ParseError,message:e,data:t}}}}});function op(o,r){let e=o.match($C);if(!e)return o;let[,t,n,i]=e;return`${t}${n}-${r}${i}`}function QA(o){let r=o.match($C);if(!r)throw new pn(pa,`Invalid resource URI: ${o}`);let[,e,t,n]=r,i=t.match(/^(.*)-([0-9]+)$/);if(!i)throw new pn(pa,`Invalid gateway resource URI (no server index): ${o}`);let[,s,a]=i;return{serverIndex:parseInt(a,10),originalUri:`${e}${s}${n}`}}function XA(o,r){return o.map(e=>e.type==="resource_link"?{...e,uri:op(e.uri,r)}:e.type==="resource"?{...e,resource:{...e.resource,uri:op(e.resource.uri,r)}}:e)}function qC(o){let r=Array.isArray(o)?o[0]:o;return!r||!Tn(r,{method:!0})?!1:r.method==="initialize"}var GA,jA,JA,pa,$C,ig,zC=w(()=>{QI();K();We();GA="2025-11-25",jA=-32600,JA=-32601,pa=-32602,$C=/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)([^/?#]*)(.*)/;ig=class extends C{constructor(e,t,n,i){super();this.id=e;this._logService=t;this._onDidDispose=n;this._toolInvoker=i;this._sseClients=new Set;this._pendingResponses=[];this._isCollectingPostResponses=!1;this._lastEventId=0;this._isInitialized=!1;this._rpc=this._register(new Cc(s=>this._handleOutgoingMessage(s),{handleRequest:s=>this._handleRequest(s),handleNotification:s=>this._handleNotification(s)})),this._register(this._toolInvoker.onDidChangeTools(()=>{this._isInitialized&&this._rpc.sendNotification({method:"notifications/tools/list_changed"})})),this._register(this._toolInvoker.onDidChangeResources(()=>{this._isInitialized&&this._rpc.sendNotification({method:"notifications/resources/list_changed"})}))}attachSseClient(e,t){t.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"}),t.write(`: connected

`),this._sseClients.add(t),t.on("close",()=>{this._sseClients.delete(t)})}async handleIncoming(e){this._pendingResponses.length=0,this._isCollectingPostResponses=!0;try{return await this._rpc.handleMessage(e),[...this._pendingResponses]}finally{this._isCollectingPostResponses=!1,this._pendingResponses.length=0}}dispose(){for(let e of this._sseClients)e.destroyed||e.end();this._sseClients.clear(),this._onDidDispose(),super.dispose()}_handleOutgoingMessage(e){if(jI(e)){this._isCollectingPostResponses&&this._pendingResponses.push(e);return}if(JI(e)){this._broadcastSse(e);return}this._logService.warn("[McpGatewayService] Ignored unsupported outgoing gateway message")}_broadcastSse(e){if(this._sseClients.size===0)return;let t=JSON.stringify(e),n=String(++this._lastEventId),i=t.split(/\r?\n/g),s=[`id: ${n}`,"event: message",...i.map(a=>`data: ${a}`),"",""].join(`
`);for(let a of[...this._sseClients]){if(a.destroyed||a.writableEnded){this._sseClients.delete(a);continue}a.write(s)}}async _handleRequest(e){if(e.method==="initialize")return this._handleInitialize();if(!this._isInitialized)throw new pn(jA,"Session is not initialized");switch(e.method){case"ping":return{};case"tools/list":return this._handleListTools();case"tools/call":return this._handleCallTool(e);case"resources/list":return this._handleListResources();case"resources/read":return this._handleReadResource(e);case"resources/templates/list":return this._handleListResourceTemplates();default:throw new pn(JA,`Method not found: ${e.method}`)}}_handleNotification(e){e.method==="notifications/initialized"&&(this._isInitialized=!0,this._rpc.sendNotification({method:"notifications/tools/list_changed"}),this._rpc.sendNotification({method:"notifications/resources/list_changed"}))}_handleInitialize(){return{protocolVersion:GA,capabilities:{tools:{listChanged:!0},resources:{listChanged:!0}},serverInfo:{name:"VS Code MCP Gateway",version:"1.0.0"}}}async _handleCallTool(e){let t=typeof e.params=="object"&&e.params?e.params:void 0;if(!t||typeof t.name!="string")throw new pn(pa,"Missing tool call params");if(t.arguments&&typeof t.arguments!="object")throw new pn(pa,"Invalid tool call arguments");let n=t.arguments&&typeof t.arguments=="object"?t.arguments:{};try{let{result:i,serverIndex:s}=await this._toolInvoker.callTool(t.name,n);return{...i,content:XA(i.content,s)}}catch(i){throw this._logService.error("[McpGatewayService] Tool call invocation failed",i),new pn(pa,String(i))}}_handleListTools(){return this._toolInvoker.listTools().then(e=>({tools:e}))}async _handleListResources(){let e=await this._toolInvoker.listResources(),t=[];for(let{serverIndex:n,resources:i}of e)for(let s of i)t.push({...s,uri:op(s.uri,n)});return{resources:t}}async _handleReadResource(e){let t=typeof e.params=="object"&&e.params?e.params:void 0;if(!t||typeof t.uri!="string")throw new pn(pa,"Missing resource URI");let{serverIndex:n,originalUri:i}=QA(t.uri);try{return{contents:(await this._toolInvoker.readResource(n,i)).contents.map(a=>({...a,uri:op(a.uri,n)}))}}catch(s){throw this._logService.error("[McpGatewayService] Resource read failed",s),new pn(pa,String(s))}}async _handleListResourceTemplates(){let e=await this._toolInvoker.listResourceTemplates(),t=[];for(let{serverIndex:n,resourceTemplates:i}of e)for(let s of i)t.push({...s,uriTemplate:op(s.uriTemplate,n)});return{resourceTemplates:t}}}});var _c,XI,GC=w(()=>{he();QI();K();se();Mt();re();zC();_c=class extends C{constructor(e){super();this._logService=e;this._gateways=new Map;this._gatewayToClient=new Map}async createGateway(e,t){if(await this._ensureServer(),this._port===void 0)throw new Error("[McpGatewayService] Server failed to start, port is undefined");let n=xe();if(!t)throw new Error("[McpGatewayService] Tool invoker is required to create gateway");let i=new XI(n,this._logService,t);return this._gateways.set(n,i),e?(this._gatewayToClient.set(n,e),this._logService.info(`[McpGatewayService] Created gateway at http://127.0.0.1:${this._port}/gateway/${n} for client ${e}`)):this._logService.warn(`[McpGatewayService] Created gateway without client tracking at http://127.0.0.1:${this._port}/gateway/${n}`),{address:b.parse(`http://127.0.0.1:${this._port}/gateway/${n}`),gatewayId:n}}async disposeGateway(e){let t=this._gateways.get(e);if(!t){this._logService.warn(`[McpGatewayService] Attempted to dispose unknown gateway: ${e}`);return}t.dispose(),this._gateways.delete(e),this._gatewayToClient.delete(e),this._logService.info(`[McpGatewayService] Disposed gateway: ${e}`),this._gateways.size===0&&this._stopServer()}disposeGatewaysForClient(e){let t=[];for(let[n,i]of this._gatewayToClient)i===e&&t.push(n);if(t.length>0){this._logService.info(`[McpGatewayService] Disposing ${t.length} gateway(s) for disconnected client ${e}`);for(let n of t)this._gateways.get(n)?.dispose(),this._gateways.delete(n),this._gatewayToClient.delete(n);this._gateways.size===0&&this._stopServer()}}async _ensureServer(){if(!this._server?.listening){if(this._serverStartPromise)return this._serverStartPromise;this._serverStartPromise=this._startServer();try{await this._serverStartPromise}finally{this._serverStartPromise=void 0}}}async _startServer(){let{createServer:e}=await import("http"),t=new Gt;this._server=e((i,s)=>{this._handleRequest(i,s)});let n=setTimeout(()=>{t.error(new Error("[McpGatewayService] Timeout waiting for server to start"))},5e3);return this._server.on("listening",()=>{let i=this._server.address();if(typeof i=="string")this._port=parseInt(i);else if(i instanceof Object)this._port=i.port;else{clearTimeout(n),t.error(new Error("[McpGatewayService] Unable to determine port"));return}clearTimeout(n),this._logService.info(`[McpGatewayService] Server started on port ${this._port}`),t.complete()}),this._server.on("error",i=>{if(i.code==="EADDRINUSE"){this._logService.warn("[McpGatewayService] Port in use, retrying with random port..."),this._server.listen(0,"127.0.0.1");return}clearTimeout(n),this._logService.error(`[McpGatewayService] Server error: ${i}`),t.error(i)}),this._server.listen(0,"127.0.0.1"),t.p}_stopServer(){this._server&&(this._logService.info("[McpGatewayService] Stopping server (no more gateways)"),this._server.close(e=>{e?this._logService.error(`[McpGatewayService] Error closing server: ${e}`):this._logService.info("[McpGatewayService] Server stopped")}),this._server=void 0,this._port=void 0)}_handleRequest(e,t){let i=new URL(e.url,`http://${e.headers.host}`).pathname.split("/").filter(Boolean);if(i.length>=2&&i[0]==="gateway"){let s=i[1],a=this._gateways.get(s);if(a){a.handleRequest(e,t);return}}t.writeHead(404,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:"Gateway not found"}))}dispose(){this._stopServer();for(let e of this._gateways.values())e.dispose();this._gateways.clear(),super.dispose()}};_c=T([g(0,O)],_c);XI=class o extends C{constructor(e,t,n){super();this.gatewayId=e;this._logService=t;this._toolInvoker=n;this._sessions=new Map}static{this.SessionHeaderName="mcp-session-id"}handleRequest(e,t){if(e.method==="POST"){this._handlePost(e,t);return}if(e.method==="GET"){this._handleGet(e,t);return}if(e.method==="DELETE"){this._handleDelete(e,t);return}this._respondHttpError(t,405,"Method not allowed")}dispose(){for(let e of this._sessions.values())e.dispose();this._sessions.clear(),super.dispose()}_handleDelete(e,t){let n=this._getSessionId(e);if(!n){this._respondHttpError(t,400,"Missing Mcp-Session-Id header");return}let i=this._sessions.get(n);if(!i){this._respondHttpError(t,404,"Session not found");return}i.dispose(),this._sessions.delete(n),t.writeHead(204),t.end()}_handleGet(e,t){let n=this._getSessionId(e);if(!n){this._respondHttpError(t,400,"Missing Mcp-Session-Id header");return}let i=this._sessions.get(n);if(!i){this._respondHttpError(t,404,"Session not found");return}i.attachSseClient(e,t)}async _handlePost(e,t){let n=await this._readRequestBody(e);if(n===void 0){this._respondHttpError(t,413,"Payload too large");return}let i;try{i=JSON.parse(n)}catch(l){t.writeHead(400,{"Content-Type":"application/json"}),t.end(JSON.stringify(Cc.createParseError("Parse error",l instanceof Error?l.message:String(l))));return}let s=this._getSessionId(e),a=this._resolveSessionForPost(s,i,t);if(a)try{let l=await a.handleIncoming(i),c={"Content-Type":"application/json","Mcp-Session-Id":a.id};if(l.length===0){t.writeHead(202,c),t.end();return}t.writeHead(200,c),t.end(JSON.stringify(Array.isArray(i)?l:l[0]))}catch(l){this._logService.error("[McpGatewayService] Failed handling gateway request",l),this._respondHttpError(t,500,"Internal server error")}}_resolveSessionForPost(e,t,n){if(e){let a=this._sessions.get(e);if(!a){this._respondHttpError(n,404,"Session not found");return}return a}if(!qC(t)){this._respondHttpError(n,400,"Missing Mcp-Session-Id header");return}let i=xe(),s=new ig(i,this._logService,()=>{this._sessions.delete(i)},this._toolInvoker);return this._sessions.set(i,s),s}_respondHttpError(e,t,n){e.writeHead(t,{"Content-Type":"application/json"}),e.end(JSON.stringify({jsonrpc:"2.0",error:{code:t,message:n}}))}_getSessionId(e){let t=e.headers[o.SessionHeaderName];return Array.isArray(t)?t[0]:t}async _readRequestBody(e){let t=[],n=0,i=1024*1024;for await(let s of e){let a=Buffer.isBuffer(s)?s:Buffer.from(s);if(n+=a.byteLength,n>i)return;t.push(a)}return Buffer.concat(t).toString("utf8")}}});function YA(o,r){return o.getChannel(KC,e=>e.ctx===r)}var kc,jC=w(()=>{K();GI();kc=class extends C{constructor(e,t){super();this._ipcServer=e;this.mcpGatewayService=t;this._register(e.onDidRemoveConnection(n=>t.disposeGatewaysForClient(n.ctx)))}listen(e,t){throw new Error("Invalid listen")}async call(e,t,n){switch(t){case"createGateway":{let i=YA(this._ipcServer,e);return await this.mcpGatewayService.createGateway(e,{onDidChangeTools:i.listen("onDidChangeTools"),onDidChangeResources:i.listen("onDidChangeResources"),listTools:()=>i.call("listTools"),callTool:(a,l)=>i.call("callTool",{name:a,args:l}),listResources:()=>i.call("listResources"),readResource:(a,l)=>i.call("readResource",{serverIndex:a,uri:l}),listResourceTemplates:()=>i.call("listResourceTemplates")})}case"disposeGateway":{await this.mcpGatewayService.disposeGateway(n);return}}throw new Error(`Invalid call: ${t}`)}};kc=T([g(1,ip)],kc)});var YI,lye,JC=w(()=>{Z();YI=W("IWebContentExtractorService"),lye=W("ISharedWebContentExtractorService")});function ZI(o){let r=typeof o=="string"?b.parse(o):o;return r.with({path:r.path.replace(/\/+$/,""),query:null,fragment:null})}function QC(o,r){let e=ZI(o),t;if(/^[^./:]*:\/\//.test(r))t=ZI(r);else{if(e.scheme!=="http"&&e.scheme!=="https")return!1;t=ZI(`${e.scheme}://${r}`)}return eb(e.scheme,t.scheme)&&eb(e.authority,t.authority,!0)&&(t.path==="/"||eb(e.path,t.path))}function eb(o,r,e=!1){let t=Array.from({length:o.length+1}).map(()=>Array.from({length:r.length+1}).map(()=>{}));return go(t,e,o,r,0,0)}function go(o,r,e,t,n,i){if(o[n]?.[i]!==void 0)return o[n][i];let s=[];if(n===e.length)return i===t.length?!0:r&&t[i]+t[i+1]===":*"?i+2===t.length:!1;if(i===t.length)return e.slice(n)[0]==="/";if(e[n]===t[i]&&s.push(go(o,r,e,t,n+1,i+1)),t[i]+t[i+1]==="*."&&(["/",":"].includes(e[n])||s.push(go(o,r,e,t,n+1,i)),s.push(go(o,r,e,t,n,i+2))),t[i]==="*"&&(n+1===e.length?s.push(go(o,r,e,t,n+1,i+1)):s.push(go(o,r,e,t,n+1,i)),s.push(go(o,r,e,t,n,i+1))),r&&t[i]+t[i+1]===":*")if(e[n]===":"){let a=n+1;do a++;while(/[0-9]/.test(e[a]));s.push(go(o,r,e,t,a,i+2))}else s.push(go(o,r,e,t,n,i+2));return o[n][i]=s.some(a=>a===!0)}var XC=w(()=>{se()});function ZC(o,r){if(o=b.parse(YC(o)),r=r.map(YC),rM(o.authority))return!0;for(let e=0;e<r.length;e++)if(r[e]==="*"||QC(o,r[e]))return!0;return!1}function YC(o){let r=["github.com"];try{let e=typeof o=="string"?b.parse(o,!0):o;return r.includes(e.authority)?e.with({path:e.path.toLowerCase()}).toString(!0):e.toString(!0)}catch{return o.toString()}}function rM(o){return ZA.test(o)||eM.test(o)||tM.test(o)}var ZA,eM,tM,e_=w(()=>{se();XC();ZA=/^(.+\.)?localhost(:\d+)?$/i,eM=/^127.0.0.1(:\d+)?$/,tM=/^\[::1\](:\d+)?$/});var og,t_=w(()=>{Lr();yt();og=class o{constructor(){this._cache=new di(o.MAX_CACHE_SIZE)}static{this.MAX_CACHE_SIZE=1e3}static{this.SUCCESS_CACHE_DURATION=1e3*60*60*24}static{this.ERROR_CACHE_DURATION=1e3*60*5}add(r,e,t){let n;switch(t.status){case"ok":case"redirect":n=Date.now()+o.SUCCESS_CACHE_DURATION;break;default:n=Date.now()+o.ERROR_CACHE_DURATION;break}let i=o.getKey(r,e);this._cache.set(i,{result:t,options:e,expiration:n})}tryGet(r,e){let t=o.getKey(r,e),n=this._cache.get(t);if(n!==void 0){if(n.expiration<Date.now()){this._cache.delete(t);return}return n.result}}static getKey(r,e){return`${!!e?.followRedirects}${Oa.getComparisonKey(r)}`}}});function nM(o){if(o.length===0)return[];let r=new Map;for(let i of o)r.set(i.nodeId,i);function e(i){let s=r.get(i);if(!s||!s.childIds)return[];let a=[];for(let l of s.childIds){let c=r.get(l);c&&(c.ignored?a.push(...e(l)):a.push(l))}return a}let t=new Map;for(let i of o)i.ignored||t.set(i.nodeId,{node:i,children:[],parent:null});for(let i of o){if(i.ignored)continue;let s=t.get(i.nodeId);if(i.childIds)for(let a of i.childIds){let l=r.get(a);if(l)if(l.ignored){let c=e(a);for(let d of c){let u=t.get(d);u&&(u.parent=s,s.children.push(u))}}else{let c=t.get(a);c&&(c.parent=s,s.children.push(c))}}}let n=[];for(let i of t.values())i.parent||n.push(i);return n}function n_(o,r){let e=nM(r);if(e.length===0)return"";let t=[],n=[];for(let s of e){let a=iM(o,s),l=pM(s);a.trim().length>0&&t.push(a),n.push(...l)}return t.join(`

`)+(n.length>0?`

## Additional Links
`+n.join(`
`):"")}function iM(o,r){let e=[];return vo(o,r,e,0,!0),e.join("")}function vo(o,r,e,t,n){switch(yo(r.node)){case"navigation":return;case"heading":lM(o,r,e,t);return;case"paragraph":aM(o,r,e,t,n);return;case"list":e.push(`
`);for(let s of r.children)vo(o,s,e,t+1,!0);e.push(`
`);return;case"ListMarker":e.push(Ai(r.node,n));return;case"listitem":{let s=[];for(let l of r.children)vo(o,l,s,t+1,!0);let a=rb(r.node)>1?" ".repeat(rb(r.node)):"";e.push(`${a}${s.join("").trim()}
`);return}case"link":if(!i_(r)){let s=Ai(r.node,n),a=nb(r.node);sM(o,r.node)?e.push(s):e.push(`[${s}](${a})`)}return;case"StaticText":{let s=Ai(r.node,n);s&&e.push(s);break}case"image":{let s=Ai(r.node,n)||"Image",a=oM(r.node);a?e.push(`![${s}](${a})

`):e.push(`[Image: ${s}]

`);break}case"DescriptionList":cM(o,r,e,t);return;case"blockquote":e.push("> "+Ai(r.node,n).replace(/\n/g,`
> `)+`

`);break;case"generic":e.push(" ");break;case"code":{uM(o,r,e,t);return}case"pre":e.push("```\n"+Ai(r.node,!1)+"\n```\n\n");break;case"table":dM(r,e);return}for(let s of r.children)vo(o,s,e,t+1,n)}function yo(o){return o.role?.value||""}function Ai(o,r){let e=o.name?.value||o.value?.value||"";if(!r||e.length<=tb)return e;let t=e.split(""),n=-1;for(let i=1;i<t.length;i++)t[i]===" "&&(n=i),i%tb===0&&n!==-1&&(t[n]=`
`,n=i);return t.join("")}function rb(o){let r=o.properties?.find(e=>e.name==="level");return r?Math.min(Number(r.value.value)||1,6):1}function nb(o){return o.properties?.find(e=>e.name==="url")?.value.value||"#"}function oM(o){return o.properties?.find(e=>e.name==="url")?.value.value||null}function i_(o){let r=o;for(;r;){let e=yo(r.node);if(["navigation","menu","menubar"].includes(e))return!0;r=r.parent}return!1}function sM(o,r){let e=nb(r);try{let t=b.parse(e);return t.scheme===o.scheme&&t.authority===o.authority&&t.path===o.path}catch{return!1}}function aM(o,r,e,t,n){e.push(`
`);for(let i of r.children)vo(o,i,e,t+1,n);e.push(`

`)}function lM(o,r,e,t){e.push(`
`);let n=rb(r.node);e.push(`${"#".repeat(n)} `);for(let i of r.children)yo(i.node)==="StaticText"?e.push(Ai(i.node,!1)):vo(o,i,e,t+1,!1);e.push(`

`)}function cM(o,r,e,t){e.push(`
`);for(let n of r.children)if(yo(n.node)==="term"){e.push("- **");for(let i of n.children)vo(o,i,e,t+1,!0);e.push("** ")}else if(yo(n.node)==="definition"){for(let i of n.children)vo(o,i,e,t+1,!0);e.push(`
`)}e.push(`
`)}function r_(o){return o==="cell"||o==="gridcell"||o==="columnheader"||o==="rowheader"}function dM(o,r){r.push(`
`);let e=o.children.filter(t=>yo(t.node).includes("row"));if(e.length>0){let t=e[0].children.filter(i=>r_(yo(i.node))),n=t.map(i=>Ai(i.node,!1)||" ");r.push("| "+n.join(" | ")+` |
`),r.push("| "+t.map(()=>"---").join(" | ")+` |
`);for(let i=1;i<e.length;i++){let a=e[i].children.filter(l=>r_(yo(l.node))).map(l=>Ai(l.node,!1)||" ");r.push("| "+a.join(" | ")+` |
`)}}r.push(`
`)}function uM(o,r,e,t){let n=[];for(let s of r.children)vo(o,s,n,t+1,!1);if(n.some(s=>s.includes(`
`)))e.push("\n```\n"),e.push(n.join("")),e.push("\n```\n");else{e.push("`");let s=0;for(let a of n)s+=a.length,s>tb&&(e.push(`
`),s=0),e.push(a),e.push("`")}}function pM(o){let r=[];return o_(o,r),r}function o_(o,r){if(yo(o.node)==="link"&&i_(o)){let t=Ai(o.node,!0),n=nb(o.node),i=o.node.description?.value||"";r.push(`- [${t}](${n})${i?" - "+i:""}`)}for(let t of o.children)o_(t,r)}var tb,s_=w(()=>{se();tb=80});var sg,a_=w(()=>{he();St();Pa();K();se();Mt();s_();sg=class o extends C{constructor(e,t,n,i,s){super();this._logger=t;this._uri=n;this._options=i;this._isTrustedDomain=s;this._requests=new Set;this._queue=this._register(new Cn);this._timeout=this._register(new vd);this._idleDebounceTimer=this._register(new vd);this._onResult=e=>{};this._didFinishLoad=!1;this._window=e({width:800,height:600,show:!1,webPreferences:{partition:xe(),javascript:!0,offscreen:!0,sandbox:!0,webgl:!1}}),this._register(j(()=>this._window.destroy())),this._debugger=this._window.webContents.debugger,this._debugger.attach("1.1"),this._debugger.on("message",this.onDebugMessage.bind(this)),this._window.webContents.once("did-start-loading",this.onStartLoading.bind(this)).once("did-finish-load",this.onFinishLoad.bind(this)).once("did-fail-load",this.onFailLoad.bind(this)).on("will-navigate",this.onRedirect.bind(this)).on("will-redirect",this.onRedirect.bind(this)).on("select-client-certificate",a=>a.preventDefault()),this._window.webContents.session.webRequest.onBeforeSendHeaders(this.onBeforeSendHeaders.bind(this)),this._window.webContents.session.webRequest.onHeadersReceived(this.onHeadersReceived.bind(this)),this._window.webContents.session.on("will-download",this.onDownload.bind(this))}static{this.TIMEOUT=3e4}static{this.POST_LOAD_TIMEOUT=5e3}static{this.FRAME_TIMEOUT=500}static{this.EXTRACT_CONTENT_TIMEOUT=2e3}static{this.IDLE_DEBOUNCE_TIME=500}static{this.MIN_CONTENT_LENGTH=100}trace(e){this._logger.trace(`[WebPageLoader] [${this._uri}] ${e}`)}async load(){return await new Promise(e=>{this._onResult=Hi(t=>{switch(t.status){case"ok":this.trace(`Loaded web page content, status: ${t.status}, title: '${t.title}', length: ${t.result.length}`);break;case"redirect":this.trace(`Loaded web page content, status: ${t.status}, toURI: ${t.toURI}`);break;case"error":this.trace(`Loaded web page content, status: ${t.status}, code: ${t.statusCode}, error: '${t.error}', title: '${t.title}', length: ${t.result?.length??0}`);break}let n=t.status!=="redirect"?t.result:void 0;n!==void 0&&this.trace(n.length<200?`Extracted content: '${n}'`:`Extracted content preview: '${n.substring(0,200)}...'`),e(t),this.dispose()}),this.trace("Loading web page content"),this._window.loadURL(this._uri.toString(!0)),this.setTimeout(o.TIMEOUT)})}setTimeout(e){this._store.isDisposed||(this.trace(`Setting page load timeout to ${e} ms`),this._timeout.cancelAndSet(()=>{this.trace("Page load timeout reached"),this._queue.queue(()=>this.extractContent())},e))}onBeforeSendHeaders(e,t){let n={...e.requestHeaders};n.DNT="1",n["Sec-GPC"]="1",t({requestHeaders:n})}onHeadersReceived(e,t){let n=e.responseHeaders;if(n){let i=!1,s,a;for(let l of Object.keys(n)){let c=l.toLowerCase();c==="content-disposition"&&n[l]?.some(d=>d.toLowerCase().includes("attachment"))&&(i=!0,s=l),c==="content-type"&&(a=n[l]?.[0]?.toLowerCase())}if(i&&s){this.isTextMimeType(a)?(this.trace(`Replacing Content-Disposition: attachment with inline for ${e.url} (content-type: ${a})`),n[s]=["inline"],t({responseHeaders:n,cancel:!1})):(this.trace(`Blocked binary download (Content-Disposition: attachment, content-type: ${a}) for ${e.url}`),t({cancel:!0}));return}}t({cancel:!1})}static{this.TEXT_MIME_TYPE_RE=/^(?:text\/|application\/(?:json|xml|xhtml\+xml|rss\+xml|atom\+xml|svg\+xml|javascript|ecmascript|x-yaml|yaml|toml|.*\+(?:xml|json))$)/}isTextMimeType(e){let t=e?.split(";")[0].trim();return!!t&&o.TEXT_MIME_TYPE_RE.test(t)}onDownload(e,t){let n=t.getFilename();this.trace(`Blocked download: ${n}`),t.cancel(),this._queue.queue(()=>this.extractContent({status:"error",error:`Download not allowed: ${n}`}))}onStartLoading(){this._store.isDisposed||(this.trace("Received 'did-start-loading' event"),this._debugger.sendCommand("Network.enable").catch(()=>{}))}onFinishLoad(){this._store.isDisposed||(this.trace("Received 'did-finish-load' event"),this._didFinishLoad=!0,this.scheduleIdleCheck(),this.setTimeout(o.POST_LOAD_TIMEOUT))}onFailLoad(e,t,n){this._store.isDisposed||(this.trace(`Received 'did-fail-load' event, code: ${t}, error: '${n}'`),t===-3?(this.trace("Ignoring ERR_ABORTED (-3) as it may be caused by CSP or other measures"),this._queue.queue(()=>this.extractContent())):t===-27?(this.trace("Ignoring ERR_BLOCKED_BY_CLIENT (-27) as it may be caused by ad-blockers or similar extensions"),this._queue.queue(()=>this.extractContent())):this._queue.queue(()=>this.extractContent({status:"error",statusCode:t,error:n})))}onRedirect(e,t){if(!this._store.isDisposed&&(this.trace(`Received 'will-navigate' or 'will-redirect' event, url: ${t}`),!this._options?.followRedirects)){let n=b.parse(t);if(this.normalizeAuthority(n.authority)===this.normalizeAuthority(this._uri.authority)||this._isTrustedDomain(n))return;if(this._didFinishLoad){this.trace(`Blocking post-load navigation to ${t} (likely ad/tracker script)`),e.preventDefault();return}e.preventDefault(),this._onResult({status:"redirect",toURI:n})}}normalizeAuthority(e){return e.toLowerCase().replace(/^www\./,"")}onDebugMessage(e,t,n){if(this._store.isDisposed)return;let{requestId:i,type:s,response:a}=n;switch(t){case"Network.requestWillBeSent":i!==void 0&&(this._requests.add(i),this._idleDebounceTimer.cancel());break;case"Network.loadingFinished":case"Network.loadingFailed":i!==void 0&&(this._requests.delete(i),this._requests.size===0&&this._didFinishLoad&&this.scheduleIdleCheck());break;case"Network.responseReceived":if(s==="Document"){let l=a?.status??0;if(l>=400){let c=a?.statusText||`HTTP error ${l}`;this._queue.queue(()=>this.extractContent({status:"error",statusCode:l,error:c}))}}break}}scheduleIdleCheck(){this._store.isDisposed||this._idleDebounceTimer.cancelAndSet(async()=>{this._store.isDisposed||(await this.nextFrame(),this._requests.size===0?this._queue.queue(()=>this.extractContent()):this.trace("New network requests detected, deferring content extraction"))},o.IDLE_DEBOUNCE_TIME)}async nextFrame(){this._store.isDisposed||await Dv(new Promise(e=>{try{this.trace("Waiting for a frame to be rendered"),this._window.webContents.beginFrameSubscription(!1,()=>{try{this.trace("A frame has been rendered"),this._window.webContents.endFrameSubscription()}catch{}e()})}catch{e()}}),o.FRAME_TIMEOUT)}async extractContent(e){if(!this._store.isDisposed)try{let t=this._window.webContents.getTitle(),n="",i=new qe;try{await Dv((async()=>{if(i.token.isCancellationRequested||(n=await this.extractAccessibilityTreeContent(i.token)??""),!i.token.isCancellationRequested&&n.length<o.MIN_CONTENT_LENGTH){this.trace("Accessibility tree extraction yielded insufficient content, trying main DOM element extraction");let s=await this.extractMainDomElementContent()??"";n=s.length>n.length?s:n}})(),o.EXTRACT_CONTENT_TIMEOUT)}finally{i.cancel(),i.dispose()}n.length===0?this._onResult({status:"error",error:"Failed to extract meaningful content from the web page"}):e!==void 0?this._onResult({...e,result:n,title:t}):this._onResult({status:"ok",result:n,title:t})}catch(t){e!==void 0?this._onResult(e):this._onResult({status:"error",error:t instanceof Error?t.message:String(t)})}}async extractAccessibilityTreeContent(e){this.trace("Extracting content using Accessibility domain");try{if(await this._debugger.sendCommand("Page.enable"),e.isCancellationRequested)return;let{frameTree:t}=await this._debugger.sendCommand("Page.getFrameTree");if(e.isCancellationRequested)return;let n=[t];for(let s=0;s<n.length;s++)n.push(...n[s].childFrames??[]);let i=[];for(let{frame:s}of n)try{let{nodes:a}=await this._debugger.sendCommand("Accessibility.getFullAXTree",{frameId:s.id});if(i.push(...a),e.isCancellationRequested)return}catch{}return n_(this._uri,i)}catch(t){this.trace(`Accessibility tree extraction failed: ${t instanceof Error?t.message:String(t)}`);return}}async extractMainDomElementContent(){try{return this.trace("Extracting content from main DOM element"),await this._window.webContents.executeJavaScript(`
				(() => {
					const selectors = ['main','article','[role="main"]','.main-content','#main-content','.article-body','.post-content','.entry-content','.content','body'];
					for (const selector of selectors) {
						const content = document.querySelector(selector)?.textContent?.replace(/[ \\t]+/g, ' ').replace(/\\s{2,}/gm, '\\n').trim();
						if (content && content.length > ${o.MIN_CONTENT_LENGTH}) {
							return content;
						}
					}
					return undefined;
				})();
			`)}catch(e){this.trace(`DOM extraction failed: ${e instanceof Error?e.message:String(e)}`);return}}}});import{BrowserWindow as fM}from"electron";var Rc,l_=w(()=>{he();re();e_();t_();a_();Rc=class{constructor(r){this._logger=r;this._limiter=new gd(3);this._webContentsCache=new og}extract(r,e){return r.length===0?(this._logger.info("No URIs provided for extraction"),Promise.resolve([])):(this._logger.info(`Extracting content from ${r.length} URIs`),Promise.all(r.map(t=>this._limiter.queue(()=>this.doExtract(t,e)))))}async doExtract(r,e){let t=this._webContentsCache.tryGet(r,e);if(t!==void 0)return this._logger.info(`Found cached content for ${r.toString()}`),t;let n=new sg(i=>new fM(i),this._logger,r,e,i=>ZC(i,e?.trustedDomains||[]));try{let i=await n.load();return this._webContentsCache.add(r,e,i),i}finally{n.dispose()}}};Rc=T([g(0,O)],Rc)});var c_,sp,d_=w(()=>{zt();Ve();K();yn();je();(r=>{function o(e,t){return e.callstack<t.callstack?-1:e.callstack>t.callstack?1:0}r.compare=o})(c_||={});sp=class o{constructor(r,e=o.ERROR_FLUSH_TIMEOUT){this._flushHandle=void 0;this._buffer=[];this._disposables=new te;this._telemetryService=r,this._flushDelay=e;let t=xa.addListener(n=>this._onErrorEvent(n));this._disposables.add(j(t)),this.installErrorListeners()}static{this.ERROR_FLUSH_TIMEOUT=5*1e3}dispose(){clearTimeout(this._flushHandle),this._flushBuffer(),this._disposables.dispose()}installErrorListeners(){}_onErrorEvent(r){if(!r||r.code||(r.detail&&r.detail.stack&&(r=r.detail),on.isErrorNoTelemetry(r)||r instanceof Jt||Np.is(r)||typeof r?.message=="string"&&r.message.includes("Unable to read file")))return;let e=Array.isArray(r.stack)?r.stack.join(`
`):r.stack,t=r.message?r.message:Ky(r);e&&this._enqueue({msg:t,callstack:e})}_enqueue(r){let e=mS(this._buffer,r,c_.compare);e<0?(r.count=1,this._buffer.splice(~e,0,r)):(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 r of this._buffer)this._telemetryService.publicLogError2("UnhandledError",r);this._buffer.length=0}}});var fa,u_=w(()=>{Ve();d_();ir();fa=class extends sp{constructor(e,t){super(t);this.logService=e}installErrorListeners(){Bp(e=>this.onUnexpectedError(e)),process.on("uncaughtException",e=>{lS(e)||rt(e)}),process.on("unhandledRejection",e=>rt(e))}onUnexpectedError(e){this.logService.error(`[uncaught exception in main]: ${e}`),e.stack&&this.logService.error(e.stack)}};fa=T([g(1,ot)],fa)});var p_,Dc,f_=w(()=>{Ve();We();Z();re();ir();zh();p_=W("IExtensionSignatureVerificationService"),Dc=class{constructor(r,e){this.logService=r;this.telemetryService=e}vsceSign(){return this.moduleLoadingPromise||(this.moduleLoadingPromise=this.resolveVsceSign()),this.moduleLoadingPromise}async resolveVsceSign(){return import("@vscode/vsce-sign")}async verify(r,e,t,n,i){let s;try{s=await this.vsceSign()}catch(d){this.logService.error("Could not load vsce-sign module",qt(d)),this.logService.info(`Extension signature verification is not done: ${r}`);return}let a=new Date().getTime(),l;try{this.logService.trace(`Verifying extension signature for ${r}...`),l=await s.verify(t,n,this.logService.getLevel()===1)}catch(d){l={code:"UnknownError",didExecute:!1,output:qt(d)}}let c=new Date().getTime()-a;return this.logService.info(`Extension signature verification result for ${r}: ${l.code}. ${_S(l.internalCode)?`Internal Code: ${l.internalCode}. `:""}Executed: ${l.didExecute}. Duration: ${c}ms.`),this.logService.trace(`Extension signature verification output for ${r}:
${l.output}`),this.telemetryService.publicLog2("extensionsignature:verification",{extensionId:r,extensionVersion:e,code:l.code,internalCode:l.internalCode,duration:c,didExecute:l.didExecute,clientTargetPlatform:i}),{code:l.code}}};Dc=T([g(0,O),g(1,ot)],Dc)});function ag(o){return o===2}var ap,lg=w(()=>{ze();Y();se();ap=class o{static customAppIconsRootURI(){return et.asFileUri("vs/workbench/contrib/windsurfCustomAppIcon/browser/media")}static icnsFilePath(r){if(Lt!==2)throw new Error("icns file paths are only supported on macOS.");let e=`${r}/${r}.icns`;return b.joinPath(o.customAppIconsRootURI(),e)}static pngFilePathSegments(r){let e=`${r}/${r}.png`;return b.joinPath(o.customAppIconsRootURI(),e)}static dockPngFilePathSegments(r){if(Lt!==2)throw new Error("Dock PNG file paths are only supported on macOS.");let e=`${r}/${r}-dock.png`;return b.joinPath(o.customAppIconsRootURI(),e)}}});var cg,lp,Wc,dg=w(()=>{cg=class extends Error{constructor(r){let e=`Failed to enact system-level icon change${r?`: ${r}`:""}`;super(e)}},lp=class extends Error{constructor(r){let e=`The source file for this icon is missing${r?`: ${r}`:""}`;super(e)}},Wc=class extends Error{constructor(){super("App icon customization is not supported on this OS")}}});import{app as m_,nativeImage as mM}from"electron";import*as fs from"fs";var Lc,h_=w(()=>{se();Se();qr();lg();dg();Qt();Bn();Lc=class{constructor(r,e){this.environmentService=r;this.productService=e;this._lastSetIconPromise=Promise.resolve()}_getAppRoot(r){let e=r==="file"?"":"vscode-app";return b.from({scheme:r,authority:e,path:this.environmentService.appRoot})}_setDockIconImage(r){let e=ap.dockPngFilePathSegments(r),t=mM.createFromPath(e.fsPath);if(t.isEmpty())throw new lp;m_.dock?.setIcon(t)}async _setIcnsIconImage(r){let e=this._getIcnsUri(r),t=this._getTempIcnsUri(),n=m_.getPath("exe"),i=U(n,"..","..","Resources",this._getIcnsFileName());try{await fs.promises.access(e.fsPath,fs.constants.R_OK)}catch(s){throw new lp(s instanceof Error?s.message:String(s))}try{await fs.promises.copyFile(i,t.fsPath)}catch{}try{await fs.promises.copyFile(e.fsPath,i)}catch(s){try{await fs.promises.copyFile(t.fsPath,i)}catch{}throw new cg(s instanceof Error?s.message:String(s))}finally{try{await fs.promises.unlink(t.fsPath)}catch{}}}async setIcon(r){return this._lastSetIconPromise=this._lastSetIconPromise.catch(()=>{}).then(async()=>{await this._setIcnsIconImage(r),this._setDockIconImage(r)}),this._lastSetIconPromise}_getIcnsUri(r){return ap.icnsFilePath(r)}_getTempIcnsUri(){return b.joinPath(this._getAppRoot("file"),"resources","darwin","custom-app-icons","Windsurf.tmp.icns")}_getIcnsFileName(){return Sr.VSCODE_DEV||!this.environmentService.isBuilt?"Windsurf.icns":`${this.productService.nameShort}.icns`}};Lc=T([g(0,fr),g(1,_e)],Lc)});var Ac,Iwe,g_=w(()=>{Z();Ac=W("windsurfAppIcon"),Iwe=Ac});var ug,v_=w(()=>{Y();dg();lg();ug=class{async setIcon(r){throw ag(1)?new Error("Unexpected empty method implementation"):new Wc}}});var pg,y_=w(()=>{Y();dg();lg();pg=class{async setIcon(r){throw ag(3)?new Error("Unexpected empty method implementation"):new Wc}}});var fg,w_=w(()=>{fg=class{constructor(){this._isMenuActionMap=new Map}isMenuAction(r){return Promise.resolve(this._isMenuActionMap.get(r)??!1)}setIsMenuAction(r,e){this._isMenuActionMap.set(r,e)}}});function wo(o){if(o){if(Rt(o))return o.uri;if(it(o))return o.configPath}}var ib,Mwe,ob=w(()=>{Z();hr();ib=W("windsurfWindowsMainManager"),Mwe=W("windsurfWindowsManager")});var Uwe,cp,sb=w(()=>{Z();Uwe=W("windsurf.languageServerService"),cp=W("windsurf.languageServerMainService")});var On,I_=w(()=>{Q();ob();K();Wt();re();Se();no();Ot();Mt();Jr();se();Dm();yt();St();xt();sb();On=class extends C{constructor(e,t,n,i,s,a){super();this._windowsMainService=e;this._logService=t;this._environmentMainService=n;this._stateService=i;this._lifecycleMainService=s;this._languageServerMainService=a;this._onDidChangeWindows=this._register(new x);this.onDidChangeWindows=this._onDidChangeWindows.event;this._onDidChangeWindowGroupInfo=this._register(new x);this.onDidChangeWindowGroupInfo=this._onDidChangeWindowGroupInfo.event;this._onDidChangeWindowInfo=this._register(new x);this.onDidChangeWindowInfo=this._onDidChangeWindowInfo.event;this._activeWindowGroups=new Map;this._windowGroupsState=new Map;this._isShuttingDown=!1;this._loadWindowGroupsState(),this._register(this._lifecycleMainService.onWillLoadWindow(l=>{this._logService.info("WindsurfWindowsMainManager: Window will load",{windowId:l.window.id,workspaceUri:l.workspace});let c=wo(l.workspace);c&&this._tryRestoreWindowGroup(l.window,c)})),this._register(this._lifecycleMainService.onBeforeCloseWindow(l=>{this._logService.info("WindsurfWindowsMainManager: Window will close",{windowId:l.id,workspaceUri:l.openedWorkspace}),this._handleWindowClose(l)})),this._register(this._lifecycleMainService.onBeforeShutdown(()=>{this._isShuttingDown=!0,this._logService.info("WindsurfWindowsMainManager: Shutdown initiated, capturing current window group state");for(let[l]of this._activeWindowGroups)this._commitGroupState(l)}))}static{this.MAX_CHILDREN_PER_GROUP=3}static{this.WINDOW_GROUPS_STATE_KEY="windsurf.windowGroupsState"}_loadWindowGroupsState(){try{let e=this._stateService.getItem(On.WINDOW_GROUPS_STATE_KEY);if(e){let t=Object.entries(e).map(([n,i])=>{let s={...i,parentWorkspaceUri:i.parentWorkspaceUri?b.revive(i.parentWorkspaceUri):void 0,children:i.children.map(a=>({...a,workspaceUri:b.revive(a.workspaceUri),lastActiveTimestamp:a.lastActiveTimestamp??Date.now()})),currentActiveWindowWorkspaceUri:i.currentActiveWindowWorkspaceUri?b.revive(i.currentActiveWindowWorkspaceUri):void 0};return[n,s]});this._windowGroupsState=new Map(t)}}catch(e){this._logService.error("Failed to load window groups state",e)}}_saveWindowGroupsState(){try{this._stateService.setItem(On.WINDOW_GROUPS_STATE_KEY,Object.fromEntries(this._windowGroupsState))}catch(e){this._logService.error("Failed to save window groups state",e)}}_commitGroupState(e){let t=this._activeWindowGroups.get(e);if(t){let n=wo(t.parent.openedWorkspace),i={groupUuid:e,parentWorkspaceUri:n,children:t.children.filter(s=>s.window.openedWorkspace!==void 0).map(s=>({workspaceUri:wo(s.window.openedWorkspace),lastActiveTimestamp:s.lastActiveTimestamp})),currentActiveWindowWorkspaceUri:wo(t.currentActiveWindow?.openedWorkspace)};this._windowGroupsState.set(e,i)}else this._windowGroupsState.delete(e);this._saveWindowGroupsState()}resetAllStates(){this._logService.info("WindsurfWindowsMainManager: Resetting ALL window group states"),this._activeWindowGroups.forEach(e=>{this._showWindow(e.parent),e.children.forEach(t=>{this._showWindow(t.window)})}),this._activeWindowGroups.clear(),this._windowGroupsState.clear(),this._stateService.removeItem(On.WINDOW_GROUPS_STATE_KEY),this._saveWindowGroupsState(),this._languageServerMainService.resetAllStates(),this._onDidChangeWindows.fire([]),this._onDidChangeWindowGroupInfo.fire(void 0)}_tryRestoreWindowGroup(e,t){for(let n of this._windowGroupsState.values()){let i=n.parentWorkspaceUri;if(!i)continue;let s=this._activeWindowGroups.get(n.groupUuid);if(this._workspacesMatch(i,t))return s?(s.parent=e,s.currentActiveWindow||(s.currentActiveWindow=e),this._applyGroupWindowVisibility(n.groupUuid),this._onDidChangeWindows.fire(this.getWindowGroups()),this._logService.info("WindsurfWindowsMainManager: Parent window added to existing group",{groupId:n.groupUuid,parentWindowId:e.id,existingChildrenCount:s.children.length})):(this._activeWindowGroups.set(n.groupUuid,{parent:e,children:[],currentActiveWindow:void 0}),this._restoreWindowGroup(n,e)),n.groupUuid;if(n.children.some(a=>this._workspacesMatch(a.workspaceUri,t))){if(s)if(s.children.some(l=>l.window.id===e.id))this._logService.info("WindsurfWindowsMainManager: Child window already exists in group, skipping",{groupId:n.groupUuid,childWindowId:e.id});else{let l=n.children.find(c=>this._workspacesMatch(b.revive(c.workspaceUri),t));if(l){let c=l.lastActiveTimestamp?typeof l.lastActiveTimestamp=="string"?Date.parse(l.lastActiveTimestamp):Number(l.lastActiveTimestamp):Date.now();s.children.push({window:e,lastActiveTimestamp:isNaN(c)?Date.now():c}),e.win?.hide(),e.ready().then(()=>e.win?.hide()),this._applyGroupWindowVisibility(n.groupUuid),this._logService.info("WindsurfWindowsMainManager: Child window reconnected to existing group",{groupId:n.groupUuid,childWindowId:e.id,childWorkspaceUri:t.toString()})}}else e.win?.hide(),e.ready().then(()=>e.win?.hide()),this._logService.info("WindsurfWindowsMainManager: Child window waiting for parent restoration",{groupId:n.groupUuid,childWindowId:e.id,childWorkspaceUri:t.toString()});return n.groupUuid}}}async _restoreWindowGroup(e,t){let n=e.groupUuid;try{let i=[];for(let s of e.children)if(s.workspaceUri){let a=this._findWindowByWorkspaceUri(s.workspaceUri);if(!a)continue;a.win?.hide(),a.ready().then(()=>a?.win?.hide()),i.push({window:a,lastActiveTimestamp:Date.now()})}this._activeWindowGroups.set(e.groupUuid,{parent:t,children:i,currentActiveWindow:t}),this._applyGroupWindowVisibility(e.groupUuid),this._onDidChangeWindows.fire(this.getWindowGroups()),this._logService.info("WindsurfWindowsMainManager: Window group restored successfully",{groupId:n,parentWindowId:t.id,childrenIds:i.map(s=>s.window.id)})}catch(i){this._logService.error("WindsurfWindowsMainManager: Failed to restore window group",{groupId:n,error:i})}}getWindowGroups(){return Array.from(this._activeWindowGroups.entries()).map(([e])=>this.getWindowsInGroup(e))}async setActiveWindowInGroup(e,t){let n=b.revive(e),i=await this._ensureChildWindowInGroup(n,t);if(!i){this._logService.info("WindsurfWindowsMainManager: window not found for workspace URI",e.toString());return}i.ready().then(()=>{this._showWindowInGroup(i,t)})}async setActiveWindowInGroupWithFilesToOpen(e,t,n){let i=b.revive(e),s=await this._ensureChildWindowInGroup(i,t);if(!s){this._logService.error("WindsurfWindowsMainManager: failed to ensure window exists for file opening",i.toString());return}let a={filesToOpenOrCreate:n.map(l=>({fileUri:b.revive(l)}))};try{s.sendWhenReady("vscode:openFiles",be.None,a)}catch(l){this._logService.error("WindsurfWindowsMainManager: failed to send openFiles IPC",{windowId:s.id,err:l})}s.ready().then(()=>{this._showWindowInGroup(s,t)})}_showWindowInGroup(e,t){let n=this._activeWindowGroups.get(t);if(!n){this._logService.warn("WindsurfWindowsMainManager: group not found during activation",t);return}let i=n.currentActiveWindow;i&&this.AlignWindowWithTarget(e,i),i===e?this._applyGroupWindowVisibility(t):(this._showWindow(e),i&&this._hideWindow(i,t)),n.currentActiveWindow=e,this._updateChildTimestamp(t,e.id)}async setMostRecentActiveChildWindowInGroup(e,t,n){let i=b.revive(e);await this._ensureChildWindowInGroup(i,t,n)}async _ensureChildWindowInGroup(e,t,n){let i=this._activeWindowGroups.get(t);if(!i){this._logService.warn("WindsurfWindowsMainManager: group not found",t);return}let s=wo(i.parent.openedWorkspace);if(s&&this._workspacesMatch(e,s))return i.parent;let a=i.children.find(d=>{let u=wo(d.window.openedWorkspace);return u&&this._workspacesMatch(e,u)}),l;if(a)this._logService.info("WindsurfWindowsMainManager: found existing child, updating timestamp",{windowId:a.window.id,workspaceUri:e.toString()}),this._updateChildTimestamp(t,a.window.id),l=a.window;else{let d=this._findWindowByWorkspaceUri(e);if(d)this._logService.info("WindsurfWindowsMainManager: found existing window globally, adding to group",{windowId:d.id,workspaceUri:e.toString()}),this._addChildToGroup(d,i.parent,t),l=d;else{let u=[{workspaceUri:e}];this._logService.info("WindsurfWindowsMainManager: creating new child window",{workspaceUri:e.toString(),groupId:t});try{l=await this.createChildWindow(t,u,n)}catch(f){this._logService.error("WindsurfWindowsMainManager: failed to create child window",{groupId:t,workspaceUri:e.toString(),error:f});return}}}let c=this._evictOldestChildIfNeeded(t);return c&&(this._logService.info("WindsurfWindowsMainManager: closing evicted window after operation",{evictedWindowId:c.id}),c.win?.close()),l}_hideWindow(e,t){let n=this._activeWindowGroups.get(t);if(!n){this._logService.warn("WindsurfWindowsMainManagerService: group not found",t);return}e.win?.hide(),n.currentActiveWindow=void 0}_showWindow(e){e.win?.show(),e.focus(),e.win?.moveTop()}getWindowById(e){let t=this._windowsMainService.getWindowById(e);if(t)return this._getICodeWindowInfo(t);throw new Error("Window not found")}_getWorkspaceDisplayName(e){if(!e.openedWorkspace)return"Untitled";let t=e.openedWorkspace;return"uri"in t&&t.uri?ye(t.uri.path)||"Untitled Folder":"configPath"in t&&t.configPath?ye(t.configPath.path).replace(/\.windsurf-workspace$/,"")||"Untitled Workspace":t.id||"Unknown Workspace"}_getICodeWindowInfo(e){let t,n,i=!1;for(let[s,a]of this._activeWindowGroups)if(a.parent.id===e.id){i=!0,n=s;break}if(!i){for(let[s,a]of this._activeWindowGroups)if(a.children.find(c=>c.window.id===e.id)){t=wo(a.parent.openedWorkspace),n=s;break}}return{windowId:e.id,workspaceUri:wo(e.openedWorkspace),workspaceDisplayName:this._getWorkspaceDisplayName(e),parentWindowWorkspaceUri:t,windowGroupId:n,isParent:i,remoteAuthority:e.remoteAuthority}}getWindowsInGroup(e){let t=this._activeWindowGroups.get(e);if(!t)throw this._logService.warn("WindsurfWindowsMainManagerService: group not found",e),new Error("Group not found");return{groupId:e,parentWindow:this._getICodeWindowInfo(t.parent),children:t.children.map(n=>this._getICodeWindowInfo(n.window)),currentAttachedActiveWindow:t.currentActiveWindow?this._getICodeWindowInfo(t.currentActiveWindow):void 0}}AlignWindowWithTarget(e,t){if(!e.win||!t.win){this._logService.warn("WindsurfWindowsMainManagerService: window not found for positioning",{windowId:e.id,targetWindowId:t.id});return}let n=t.getBounds();e.win.setBounds({x:n.x,y:n.y,width:n.width,height:n.height})}async createChildWindow(e,t,n){let i=this._activeWindowGroups.get(e);if(!i)throw new Error(`Group ${e} not found`);let s=i.parent;if(!s)throw new Error(`Parent window ${e} not found`);let a=t.length>0?t[0]:void 0,l=a&&dl(a)?a.folderUri:a&&Ks(a)?a.workspaceUri:void 0;if(l){let u=this._findWindowByWorkspaceUri(l);if(u)return i.children.find(m=>m.window.id===u.id)||(this._addChildToGroup(u,s,e),u.win?.hide()),u}let c=await this._windowsMainService.open({context:5,contextWindowId:s.id,cli:this._environmentMainService.args,urisToOpen:t,forceNewWindow:!0,remoteAuthority:n});if(!c||c.length===0)throw this._logService.error("WindsurfWindowsMainManager: failed to create child window - no windows returned",{groupId:e,openable:t}),new Error("Failed to create child window");let d=c[0];return d.win?.hide(),d.ready().then(()=>{this._addChildToGroup(d,s,e)}),d}async deleteChildWindow(e,t){let n=this._activeWindowGroups.get(t);if(!n){this._logService.warn("WindsurfWindowsMainManagerService: group not found",t);return}let i=b.revive(e),s=this._findWindowByWorkspaceUri(i);if(!s){this._logService.warn("WindsurfWindowsMainManagerService: child window not found for workspace URI",e.toString());return}n.parent.win?.show(),n.currentActiveWindow=n.parent;let a=n.children.findIndex(l=>l.window.id===s.id);a!==-1?n.children.splice(a,1):this._logService.warn("WindsurfWindowsMainManagerService: child not found in group",{workspaceUri:e.toString(),groupId:t,childrenIds:n.children.map(l=>l.window.id)}),this._commitGroupState(t),this._onDidChangeWindowGroupInfo.fire(this.getWindowsInGroup(t)),s.close()}_addChildToGroup(e,t,n){let i=this._activeWindowGroups.get(n);i||(i={parent:t,children:[],currentActiveWindow:t},this._activeWindowGroups.set(n,i)),i.children.push({window:e,lastActiveTimestamp:Date.now()}),this._commitGroupState(n),this._onDidChangeWindows.fire(this.getWindowGroups()),this._onDidChangeWindowGroupInfo.fire(this.getWindowsInGroup(n))}initializeWindowGroup(e){let t=this._windowsMainService.getWindowById(e);if(!t)throw this._logService.warn("WindsurfWindowsMainManagerService: parent window not found",e),new Error(`Parent window ${e} not found`);if(this._isWindowInAnyGroup(t))throw this._logService.warn("WindsurfWindowsMainManagerService: parent window already in group",e),new Error(`Parent window ${e} already in group`);let n=xe();return this._activeWindowGroups.set(n,{parent:t,children:[],currentActiveWindow:t}),this._logService.info("WindsurfWindowsMainManagerService: initialized window group",{parentId:e,groupUuid:n}),this._commitGroupState(n),n}_workspacesMatch(e,t){if(!t||!e)return!1;let n=Fa(e),i=Fa(t);return Ge.isEqual(n,i)}_applyGroupWindowVisibility(e){let t=this._activeWindowGroups.get(e);if(t){for(let n of t.children)n.window.win?.hide();t.parent.win?.hide(),t.currentActiveWindow?t.currentActiveWindow.win?.show():(t.parent.win?.show(),t.currentActiveWindow=t.parent)}}_findWindowByWorkspaceUri(e){let t=Fa(e);return _i(this._windowsMainService.getWindows(),t)}_updateChildTimestamp(e,t){let n=this._activeWindowGroups.get(e);if(!n)return;let i=n.children.find(s=>s.window.id===t);i&&(i.lastActiveTimestamp=Date.now())}_evictOldestChildIfNeeded(e){let t=this._activeWindowGroups.get(e);if(!t||t.children.length<=On.MAX_CHILDREN_PER_GROUP)return;let i=[...t.children].sort((a,l)=>a.lastActiveTimestamp-l.lastActiveTimestamp)[0];this._logService.info("WindsurfWindowsMainManager: evicting oldest child window",{groupId:e,evictedWindowWorkspace:i.window.openedWorkspace,evictedTimestamp:i.lastActiveTimestamp,childrenBeforeEviction:t.children.length,maxChildren:On.MAX_CHILDREN_PER_GROUP});let s=t.children.indexOf(i);if(s!==-1)return t.children.splice(s,1),this._commitGroupState(e),this._onDidChangeWindowGroupInfo.fire(this.getWindowsInGroup(e)),i.window}_isWindowInAnyGroup(e){return this._findWindowGroup(e.id)!==void 0}_handleWindowClose(e){let t=e.id;if(this._isShuttingDown){this._logService.debug("WindsurfWindowsMainManager: Ignoring window close during shutdown",{windowId:t});return}let n=this._findWindowGroup(t);if(!n)return;let i=this._activeWindowGroups.get(n);if(i){this._commitGroupState(n),this._activeWindowGroups.delete(n);for(let s of i.children)s.window.id!==t&&s.window.win&&!s.window.win.isDestroyed()&&(this._logService.debug("WindsurfWindowsMainManager: Closing child window",{childWindowId:s.window.id}),s.window.close());i.parent.id!==t&&i.parent.win&&!i.parent.win.isDestroyed()&&(this._logService.debug("WindsurfWindowsMainManager: Closing parent window",{parentWindowId:i.parent.id}),i.parent.close()),this._onDidChangeWindows.fire(this.getWindowGroups())}}getWindowByWorkspaceUri(e){let t=b.revive(e),n=this._findWindowByWorkspaceUri(t);if(n)return this._getICodeWindowInfo(n)}_findWindowGroup(e){for(let[t,n]of this._activeWindowGroups)if(n.parent.id===e||n.children.some(i=>i.window.id===e))return t}};On=T([g(0,Le),g(1,O),g(2,Te),g(3,ft),g(4,me),g(5,cp)],On)});var Mi,b_=w(()=>{Q();K();re();Jr();se();xt();Mi=class extends C{constructor(e,t,n){super();this._stateService=e;this._logService=t;this._lifecycleMainService=n;this._onDidSetLsClientInitInfo=this._register(new x);this.onDidChangeLsClientInfos=this._onDidSetLsClientInitInfo.event;this._lsGroups=new Map;this.loadWorktreeLsGroupsState(),this._register(this._lifecycleMainService.onBeforeShutdown(()=>{this.saveWorktreeLsGroupsState()}))}static{this.WINDSURF_LS_GROUPS_STATE_KEY="windsurf.lsGroupsState"}setLsGroupsState(e,t){this._lsGroups.set(e,t),this.saveWorktreeLsGroupsState()}getLsGroupsState(e){let t=this._lsGroups.get(e);return t?Promise.resolve(t):Promise.resolve(void 0)}loadWorktreeLsGroupsState(){try{let e=this._stateService.getItem(Mi.WINDSURF_LS_GROUPS_STATE_KEY);if(!e)return;for(let[t,n]of Object.entries(e)){let i={groupId:t,parentWorkspaceUri:b.revive(n.parentWorkspaceUri),children:(n.children??[]).map(s=>({parentWorkspaceUri:b.revive(n.parentWorkspaceUri),worktreeUri:b.revive(s.worktreeUri),creationTimestamp:Number(s.creationTimestamp)||Date.now()}))};this._lsGroups.set(t,i)}}catch(e){this._logService.error("[LanguageServerMainService] Error loading worktree LS group state",e)}}saveWorktreeLsGroupsState(){try{let e={};for(let[t,n]of this._lsGroups.entries())e[t]={groupId:n.groupId,parentWorkspaceUri:n.parentWorkspaceUri,children:n.children.map(i=>({parentWorkspaceUri:i.parentWorkspaceUri,worktreeUri:i.worktreeUri,creationTimestamp:i.creationTimestamp}))};this._stateService.setItem(Mi.WINDSURF_LS_GROUPS_STATE_KEY,e)}catch(e){this._logService.error("[LanguageServerMainService] Error saving worktree LS group state",e)}}resetAllStates(){this._logService.info("[LanguageServerMainService] Resetting ALL language server group states"),this._lsGroups.clear(),this._stateService.removeItem(Mi.WINDSURF_LS_GROUPS_STATE_KEY)}};Mi=T([g(0,ft),g(1,O),g(2,me)],Mi)});import{app as ii,powerMonitor as Mc,protocol as S_,session as Oc,systemPreferences as x_}from"electron";import{hostname as hM,release as gM}from"os";var ms,P_=w(()=>{Va();Qn();el();nt();Ro();Q();$g();Ji();K();ze();Se();Y();We();se();Mt();Sx();vi();Ex();sy();Ay();Ce();Sl();gP();st();wP();Em();ew();js();Of();BP();XP();Mm();YP();Bm();e0();gw();Ot();Ol();zm();f0();m0();h0();w0();M0();je();Q0();dh();Ou();Z();mh();Y0();eE();tE();xt();re();WE();$u();as();dI();LE();AE();Qt();Cl();qE();Rh();Jr();zE();hu();uI();ir();GE();jE();cs();lo();JE();YE();tT();rT();lT();Hw();cT();dT();pT();fT();gT();no();Wt();_T();kT();hr();Lm();qu();RT();jo();ri();DT();qo();ep();OI();nC();Qh();iC();oC();he();St();fC();mC();hC();Xl();gC();yC();Ic();wC();AC();OC();xo();Qs();UC();wd();kI();BC();VC();GI();GC();jC();JC();l_();u_();f_();h_();g_();v_();y_();w_();sI();I_();ob();sb();b_();ms=class extends C{constructor(e,t,n,i,s,a,l,c,d,u,f,m){super();this.mainProcessNodeIpcServer=e;this.userEnv=t;this.mainInstantiationService=n;this.logService=i;this.loggerService=s;this.environmentMainService=a;this.lifecycleMainService=l;this.configurationService=c;this.stateService=d;this.fileService=u;this.productService=f;this.userDataProfilesMainService=m;this.configureSession(),this.registerListeners()}static{this.SECURITY_PROTOCOL_HANDLING_CONFIRMATION_SETTING_KEY={[N.file]:"security.promptForLocalFileProtocolHandling",[N.vscodeRemote]:"security.promptForRemoteFileProtocolHandling"}}configureSession(){let e=m=>m?.startsWith(`${N.vscodeFileResource}://${Aa}`),t=m=>m?.startsWith(`${N.vscodeWebview}://`),n=new Set(["pointerLock","notifications"]),i=new Set([...n,"clipboard-read","clipboard-sanitized-write","fullscreen","deprecated-sync-clipboard-read"]),s=new Set([...n,"media","local-fonts","deprecated-sync-clipboard-read"]);Oc.defaultSession.setPermissionRequestHandler((m,y,v,S)=>t(S.requestingUrl)?v(i.has(y)):e(S.requestingUrl)?v(s.has(y)):v(!1)),Oc.defaultSession.setPermissionCheckHandler((m,y,v,S)=>t(S.requestingUrl)?i.has(y):e(S.requestingUrl)?s.has(y):!1);let a=new Set([N.file,N.vscodeFileResource,N.vscodeRemoteResource,N.vscodeManagedRemoteResource,"devtools"]),l=m=>{for(let y=m;y;y=y.parent)if(y.url.startsWith(`${N.vscodeWebview}://`))return!0;return!1},c=m=>m.resourceType==="xhr"||l(m.frame),d=m=>{let y=m.frame;if(!y||!this.windowsMainService)return!1;let v=Ei();for(let S of v)if(y.processId===S.webContents.mainFrame.processId)return!0;return!1},u=(m,y)=>{if(m.path!=="/index.html")return!0;let v=y.frame;if(!v||!this.windowsMainService)return!1;for(let S of this.windowsMainService.getWindows())if(S.win&&v.processId===S.win.webContents.mainFrame.processId)return!0;return!1};Oc.defaultSession.webRequest.onBeforeRequest((m,y)=>{let v=b.parse(m.url);return v.scheme===N.vscodeWebview&&!u(v,m)?(this.logService.error("Blocked vscode-webview request",m.url),y({cancel:!0})):v.scheme===N.vscodeFileResource&&!d(m)?(this.logService.error("Blocked vscode-file request",m.url),y({cancel:!0})):v.path.endsWith(".svg")&&!a.has(v.scheme)?y({cancel:!c(m)}):y({cancel:!1})}),Oc.defaultSession.webRequest.onHeadersReceived((m,y)=>{let v=m.responseHeaders,S=v["content-type"]||v["Content-Type"];if(S&&Array.isArray(S)){let I=b.parse(m.url);if(I.path.endsWith(".svg")&&a.has(I.scheme))return v["Content-Type"]=["image/svg+xml"],y({cancel:!1,responseHeaders:v});if(!I.path.endsWith(N.vscodeRemoteResource)&&S.some(k=>k.toLowerCase().includes("image/svg")))return y({cancel:!c(m)})}return y({cancel:!1})}),Oc.defaultSession.webRequest.onHeadersReceived((m,y)=>{if(m.url.startsWith("https://vscode.download.prss.microsoft.com/")){let v=m.responseHeaders??Object.create(null);if(v["Access-Control-Allow-Origin"]===void 0)return v["Access-Control-Allow-Origin"]=["*"],y({cancel:!1,responseHeaders:v})}return y({cancel:!1})});let f=Oc.defaultSession;typeof f.setCodeCachePath=="function"&&this.environmentMainService.codeCachePath&&f.setCodeCachePath(U(this.environmentMainService.codeCachePath,"chrome")),M&&(this.configurationService.getValue("security.restrictUNCAccess")===!1?T1():zi(this.configurationService.getValue("security.allowedUNCHosts")))}registerListeners(){E.once(this.lifecycleMainService.onWillShutdown)(()=>this.dispose()),Ix(),ii.on("accessibility-support-changed",(n,i)=>{this.windowsMainService?.sendToAll("vscode:accessibilitySupportChanged",i)}),ii.on("activate",async(n,i)=>{this.logService.trace("app#activate"),i||await this.windowsMainService?.openEmptyWindow({context:1})}),ii.on("web-contents-created",(n,i)=>{i?.opener?.url.startsWith(`${N.vscodeFileResource}://${Aa}/`)&&(this.logService.trace('[aux window]  app.on("web-contents-created"): Registering auxiliary window'),this.auxiliaryWindowsMainService?.registerWindow(i)),i.on("will-navigate",s=>{Xs.isBrowserViewWebContents(i)||(this.logService.error("webContents#will-navigate: Prevented webcontent navigation"),s.preventDefault())}),i.setWindowOpenHandler(s=>s.url==="about:blank"?(this.logService.trace("[aux window] webContents#setWindowOpenHandler: Allowing auxiliary window to open on about:blank"),{action:"allow",overrideBrowserWindowOptions:this.auxiliaryWindowsMainService?.createWindow(s)}):(this.logService.trace(`webContents#setWindowOpenHandler: Prevented opening window with URL ${s.url}}`),this.nativeHostMainService?.openExternal(void 0,s.url),{action:"deny"}))});let e=[],t;ii.on("open-file",(n,i)=>{i=hi(i),this.logService.trace("app#open-file: ",i),n.preventDefault(),e.push(bi(i)?{workspaceUri:b.file(i)}:{fileUri:b.file(i)}),t!==void 0&&(clearTimeout(t),t=void 0),t=setTimeout(async()=>{await this.windowsMainService?.open({context:1,cli:this.environmentMainService.args,urisToOpen:e,gotoLineMode:!1,preferNewWindow:!0}),e=[],t=void 0},100)}),ii.on("new-window-for-tab",async()=>{await this.windowsMainService?.openEmptyWindow({context:4})}),ct.handle("vscode:fetchShellEnv",n=>{let i=this.windowsMainService?.getWindowByWebContents(n.sender),s,a;return i?.config?(s=i.config,a={...process.env,...i.config.userEnv}):(s=this.environmentMainService.args,a=process.env),this.resolveShellEnvironment(s,a,!1)}),ct.on("vscode:toggleDevTools",n=>n.sender.toggleDevTools()),ct.on("vscode:openDevTools",n=>n.sender.openDevTools()),ct.on("vscode:reloadWindow",n=>n.sender.reload()),ct.handle("vscode:notifyZoomLevel",async(n,i)=>{let s=this.windowsMainService?.getWindowByWebContents(n.sender);s&&s.notifyZoomLevel(i)})}async startup(){this.logService.debug("Starting Windsurf"),this.logService.debug(`from: ${this.environmentMainService.appRoot}`),this.logService.debug("args:",this.environmentMainService.args);let e=this.productService.win32AppUserModelId;M&&e&&ii.setAppUserModelId(e);try{V&&this.configurationService.getValue("window.nativeTabs")===!0&&!x_.getUserDefault("NSUseImprovedLayoutPass","boolean")&&x_.setUserDefault("NSUseImprovedLayoutPass","boolean",!0)}catch(f){this.logService.error(f)}let t=new Af;E.once(this.lifecycleMainService.onWillShutdown)(f=>{f.reason===2&&t.dispose()});let[n,i,s]=await Promise.all([cC(this.stateService,this.logService),dC(this.stateService,this.logService),uC(this.stateService,this.logService)]),{sharedProcessReady:a,sharedProcessClient:l}=this.setupSharedProcess(n,i,s),c=await this.initServices(n,i,s,a);c.invokeFunction(f=>this._register(new fa(f.get(O),f.get(ot)))),c.invokeFunction(f=>{f.get(Qr).setTelemetryService(f.get(ot))}),c.invokeFunction(f=>f.get(gu)),this._register(c.createInstance(vc)),c.invokeFunction(f=>this.initChannels(f,t,l));let d=await c.invokeFunction(f=>this.setupProtocolUrlHandlers(f,t));this.setupManagedRemoteResourceUrlHandler(t),this.lifecycleMainService.phase=2,await c.invokeFunction(f=>this.openFirstWindow(f,d)),this.lifecycleMainService.phase=3,this.afterWindowOpen(c),this._register(new pr(()=>{this._register(yd(()=>{this.lifecycleMainService.phase=4,this.eventuallyAfterWindowOpen()},2500))},2500)).schedule()}async setupProtocolUrlHandlers(e,t){let n=this.windowsMainService=e.get(Le),i=e.get(ql),s=this.nativeHostMainService=e.get(Di),a=e.get(wn),l=this;i.registerHandler({async handleURL(y,v){return l.handleProtocolUrl(n,a,i,y,v)}});let c=this._register(new Hh({onDidOpenMainWindow:s.onDidOpenMainWindow,onDidFocusMainWindow:s.onDidFocusMainWindow,getActiveWindowId:()=>s.getActiveWindowId(-1)})),d=new Cf(y=>c.getActiveClientId().then(v=>y===v)),u=new Fh(d,this.logService),f=t.getChannel("urlHandler",u);i.registerHandler(new Oh(f));let m=await this.resolveInitialProtocolUrls(n,a);return this._register(new Uh(m?.urls,i,n,this.environmentMainService,this.productService,this.logService)),m}setupManagedRemoteResourceUrlHandler(e){let t=()=>({statusCode:404,data:"Not found"}),n=new xr(()=>e.getChannel(MC,new rg));S_.registerBufferProtocol(N.vscodeManagedRemoteResource,(i,s)=>{let a=b.parse(i.url);if(!a.authority.startsWith("window:"))return s(t());n.value.call(qI,[a]).then(l=>s({...l,data:Buffer.from(l.body,"base64")}),l=>{this.logService.warn("error dispatching remote resource call",l),s({statusCode:500,data:String(l)})})})}async resolveInitialProtocolUrls(e,t){let n=this.environmentMainService.args["open-url"]?this.environmentMainService.args._urls||[]:[];n.length>0&&this.logService.trace("app#resolveInitialProtocolUrls() protocol urls from command line:",n);let i=global.getOpenUrls?.()||[];if(i.length>0&&this.logService.trace("app#resolveInitialProtocolUrls() protocol urls from macOS 'open-url' event:",i),n.length+i.length===0)return;let s=[...n,...i].map(c=>{try{return{uri:b.parse(c),originalUrl:c}}catch{this.logService.trace("app#resolveInitialProtocolUrls() protocol url failed to parse:",c);return}}),a=[],l=[];for(let c of s){if(!c)continue;let d=this.getWindowOpenableFromProtocolUrl(c.uri);if(d)if(await this.shouldBlockOpenable(d,e,t)){this.logService.trace("app#resolveInitialProtocolUrls() protocol url was blocked:",c.uri.toString(!0));continue}else this.logService.trace("app#resolveInitialProtocolUrls() protocol url will be handled as window to open:",c.uri.toString(!0),d),a.push(d);else this.logService.trace("app#resolveInitialProtocolUrls() protocol url will be passed to active window for handling:",c.uri.toString(!0)),l.push(c)}return{urls:l,openables:a}}async shouldBlockOpenable(e,t,n){let i,s;if(Ks(e)?(i=e.workspaceUri,s=h(162,null,i.scheme===N.file?ji(i,{os:Lt,tildify:this.environmentMainService}):i.toString(!0),this.productService.nameShort)):dl(e)?(i=e.folderUri,s=h(161,null,i.scheme===N.file?ji(i,{os:Lt,tildify:this.environmentMainService}):i.toString(!0),this.productService.nameShort)):(i=e.fileUri,s=h(160,null,i.scheme===N.file?ji(i,{os:Lt,tildify:this.environmentMainService}):i.toString(!0),this.productService.nameShort)),i.scheme!==N.file&&i.scheme!==N.vscodeRemote||this.configurationService.getValue(ms.SECURITY_PROTOCOL_HANDLING_CONFIRMATION_SETTING_KEY[i.scheme])===!1)return!1;let{response:l,checkboxChecked:c}=await n.showMessageBox({type:"warning",buttons:[h(165,null),h(158,null)],message:s,detail:h(159,null),checkboxLabel:i.scheme===N.file?h(163,null):h(164,null),cancelId:1});if(l!==0)return!0;if(c){let d={channel:"vscode:disablePromptForProtocolHandling",args:i.scheme===N.file?"local":"remote"};t.sendToFocused(d.channel,d.args),t.sendToOpeningWindow(d.channel,d.args)}return!1}getWindowOpenableFromProtocolUrl(e){if(e.path){if(e.authority===N.file){let t=b.file(e.fsPath);return bi(t)?{workspaceUri:t}:{fileUri:t}}else if(e.authority===N.vscodeRemote){let t=e.path.indexOf(ue.sep,1),n,i;t!==-1?(n=e.path.substring(1,t),i=e.path.substring(t)):(n=e.path.substring(1),i="/");let s=e.query,a=new URLSearchParams(e.query);a.get("windowId")==="_blank"&&(a.delete("windowId"),s=a.toString());let l=b.from({scheme:N.vscodeRemote,authority:n,path:i,query:s,fragment:e.fragment});return bi(i)?{workspaceUri:l}:/:[\d]+$/.test(i)?{fileUri:l}:{folderUri:l}}}}async handleProtocolUrl(e,t,n,i,s){this.logService.trace("app#handleProtocolUrl():",i.toString(!0),s),i.scheme===this.productService.urlProtocol&&i.path==="workspace"&&(i=i.with({authority:"file",path:b.parse(i.query).path,query:""}));let a=!1,l=new URLSearchParams(i.query);l.get("windowId")==="_blank"?(this.logService.trace("app#handleProtocolUrl() found 'windowId=_blank' as parameter, setting shouldOpenInNewWindow=true:",i.toString(!0)),l.delete("windowId"),i=i.with({query:l.toString()}),a=!0):V&&e.getWindowCount()===0&&(this.logService.trace("app#handleProtocolUrl() running on macOS with no window open, setting shouldOpenInNewWindow=true:",i.toString(!0)),a=!0);let c=l.get("continueOn");c!==null&&(this.logService.trace("app#handleProtocolUrl() found 'continueOn' as parameter:",i.toString(!0)),l.delete("continueOn"),i=i.with({query:l.toString()}),this.environmentMainService.continueOn=c??void 0);let d=l.get("session");d!==null&&(this.logService.trace("app#handleProtocolUrl() found 'session' as parameter:",i.toString(!0)),l.delete("session"),i=i.with({query:l.toString()}));let u=this.getWindowOpenableFromProtocolUrl(i);if(u){if(await this.shouldBlockOpenable(u,e,t))return this.logService.trace("app#handleProtocolUrl() protocol url was blocked:",i.toString(!0)),!0;{this.logService.trace("app#handleProtocolUrl() opening protocol url as window:",u,i.toString(!0));let f=(await e.open({context:6,cli:{...this.environmentMainService.args},urisToOpen:[u],forceNewWindow:a,gotoLineMode:!0})).at(0);return f?.focus(),f&&d&&f.sendWhenReady("vscode:openChatSession",be.None,d),!0}}return a?(this.logService.trace("app#handleProtocolUrl() opening empty window and passing in protocol url:",i.toString(!0)),await(await e.open({context:6,cli:{...this.environmentMainService.args},forceNewWindow:!0,forceEmpty:!0,gotoLineMode:!0,remoteAuthority:so(i)})).at(0)?.ready(),n.open(i,s)):(this.logService.trace("app#handleProtocolUrl(): not handled",i.toString(!0),s),!1)}setupSharedProcess(e,t,n){let i=this._register(this.mainInstantiationService.createInstance(Zl,e,t,n));this._register(i.onDidCrash(()=>this.windowsMainService?.sendToFocused("vscode:reportSharedProcessCrash")));let s=(async()=>{this.logService.trace("Main->SharedProcess#connect");let l=await i.connect();return this.logService.trace("Main->SharedProcess#connect: connection established"),new tl(l,"main")})();return{sharedProcessReady:(async()=>(await i.whenReady(),s))(),sharedProcessClient:s}}async initServices(e,t,n,i){let s=new rs;switch(process.platform){case"win32":s.set(os,new ae(aa));break;case"linux":Dp?s.set(os,new ae(rc,[process.env.SNAP,process.env.SNAP_REVISION])):s.set(os,new ae(tc));break;case"darwin":s.set(os,new ae(ni));break}s.set(Le,new ae(dc,[e,t,n,this.userEnv],!1)),s.set(In,new ae(Tc,void 0,!1));let a=new El(this.logService,this.productService);s.set(wn,a),s.set(Kw,new ae(zl,void 0,!1)),s.set(Rl,new ae(kl,void 0,!1)),s.set(wu,He.toService(Md(i.then(m=>m.getChannel("diagnostics"))))),s.set($d,new ae(Dl)),s.set(fw,new ae(Wl,void 0,!1)),s.set(Hm,new ae(Ll,void 0,!0)),s.set(Ys,new ae(Xs,void 0,!1)),s.set(vw,new ae(Ml,void 0,!1)),s.set(Vw,new ae($l)),s.set(Di,new ae(ia,void 0,!1));let l=new Jl(this.configurationService);s.set(Qr,l),s.set(YI,new ae(Rc,void 0,!1)),s.set(II,new ae(ic)),s.set(aI,new ae(jl)),s.set(Tw,new ae(Zo)),s.set(qs,new ae(wl)),s.set(zo,new ae(Il));let c=new bc({graceTime:6e4,shortGraceTime:6e3,scrollback:this.configurationService.getValue("terminal.integrated.persistentSessionScrollback")??100},this.configurationService,this.environmentMainService,this.lifecycleMainService,this.logService),d=new Pc(c,this.configurationService,this.logService,this.loggerService);s.set(BI,d),M?s.set(Wu,new ae(Au)):V?s.set(Wu,new ae(Gm)):ne&&s.set(Wu,new ae(Mu));let u=new oo(this.environmentMainService,this.configurationService,this.logService,this.stateService);s.set(Ci,u);let f=new _l(this.environmentMainService,this.logService,this.userDataProfilesMainService,u,a);if(s.set(dn,f),s.set(Xy,new ae(uc,void 0,!1)),s.set(ss,new ae(yr,void 0,!1)),s.set(ql,new ae(nc,void 0,!1)),_h(this.productService,this.environmentMainService)){let m=VE(this.productService,this.configurationService),y=Md(i.then(R=>R.getChannel("telemetryAppender"))),v=new Wh(y),S=NE(gM(),hM(),process.arch,this.productService.commit,this.productService.version,e,t,n,m,this.productService.date),I=HE(this.environmentMainService),k={appenders:[v],commonProperties:S,piiPaths:I,sendErrorTelemetry:!0};s.set(ot,new ae(po,[k],!1))}else s.set(ot,ls);return s.set(ps,new ae(yc,void 0,!0)),s.set(rC,new ae(hc,void 0,!0)),s.set(UI,new ae(wc,void 0,!0)),s.set(gu,new ae(bl)),s.set(zI,new ae(ng)),s.set(ip,new ae(_c)),s.set(Bh,new ae(lc,void 0,!0)),V?s.set(Ac,new ae(Lc,void 0,!0)):M?s.set(Ac,new ae(ug,void 0,!0)):ne&&s.set(Ac,new ae(pg,void 0,!0)),s.set(zu,new ae(fg,void 0,!0)),s.set(ib,new ae(On,void 0,!0)),s.set(cp,new ae(Mi,void 0,!0)),this.productService.quality!=="stable"&&s.set(p_,new ae(Dc,void 0,!0)),await wt.settled([u.initialize(),f.initialize()]),this.mainInstantiationService.createChild(s)}initChannels(e,t,n){let i=this._register(new te),s=He.fromService(e.get(Kw),i,{disableMarshalling:!0});this.mainProcessNodeIpcServer.registerChannel("launch",s);let a=He.fromService(e.get(Rl),i,{disableMarshalling:!0});this.mainProcessNodeIpcServer.registerChannel("diagnostics",a);let l=i.add(new Kh(e.get(An)));t.registerChannel("policy",l),n.then(Be=>Be.registerChannel("policy",l));let c=this.fileService.getProvider(N.file);kS(c instanceof ts);let d=i.add(new fh(c,this.logService,this.environmentMainService));t.registerChannel(Mw,d),n.then(Be=>Be.registerChannel(Mw,d));let u=He.fromService(e.get(Or),i);t.registerChannel("userDataProfiles",u),n.then(Be=>Be.registerChannel("userDataProfiles",u));let f=new Lh(e.get(os));t.registerChannel("update",f);let m=new xh(e.get(Qr));t.registerChannel(cI,m),n.then(Be=>Be.registerChannel(cI,m));let y=He.fromService(new Kl(this.logService,e.get(wu),e.get(Rl)),i);t.registerChannel("process",y);let v=He.fromService(e.get($d),i);t.registerChannel("encryption",v);let S=He.fromService(e.get(fw),i);t.registerChannel("browserElements",S),n.then(Be=>Be.registerChannel("browserElements",S));let I=He.fromService(e.get(Ys),i);t.registerChannel(tw,I),n.then(Be=>Be.registerChannel(tw,I));let k=He.fromService(e.get(vw),i);t.registerChannel(mw,k),n.then(Be=>Be.registerChannel(mw,k));let R=He.fromService(e.get(ds),i);t.registerChannel("sign",R);let D=He.fromService(e.get(Vw),i);t.registerChannel("keyboardLayout",D),this.nativeHostMainService=e.get(Di);let F=He.fromService(this.nativeHostMainService,i);t.registerChannel("nativeHost",F),n.then(Be=>Be.registerChannel("nativeHost",F));let ce=He.fromService(e.get(YI),i);t.registerChannel("webContentExtractor",ce);let B=He.fromService(e.get(Xy),i);t.registerChannel("workspaces",B);let ee=He.fromService(e.get(aI),i);t.registerChannel("menubar",ee);let z=He.fromService(e.get(ql),i);t.registerChannel("url",z);let Pe=He.fromService(e.get(II),i);t.registerChannel("webview",Pe);let Pt=i.add(new Dh(this.logService,e.get(qs)));t.registerChannel("storage",Pt),n.then(Be=>Be.registerChannel("storage",Pt));let Ft=i.add(new Xh(e.get(qs),e.get(Or),this.logService));n.then(Be=>Be.registerChannel("profileStorageListener",Ft));let Ur=He.fromService(e.get(BI),i);t.registerChannel("localPty",Ur);let Nr=He.fromService(e.get(Wu),i);t.registerChannel("externalTerminal",Nr);let X=He.fromService(e.get(Ac),i);t.registerChannel("windsurfAppIcon",X);let $=He.fromService(e.get(zu),i);t.registerChannel("windsurfKeybindings",$);let J=He.fromService(e.get(ib),i);t.registerChannel("windsurfWindowsManager",J);let G=He.fromService(e.get(cp),i);t.registerChannel("windsurfLanguageServer",G);let ie=He.fromService(e.get(zI),i);t.registerChannel(NC,ie);let ve=this._register(new kc(t,e.get(ip)));t.registerChannel(HC,ve);let Re=new Yh(e.get(Wi));t.registerChannel("logger",Re),n.then(Be=>Be.registerChannel("logger",Re));let dt=new Pm(e.get(Le));t.registerChannel("extensionhostdebugservice",dt);let tt=He.fromService(e.get(Tw),i);t.registerChannel(p0,tt);let Zt=e.get(gc),sr=He.fromService(Zt,i);t.registerChannel("systemMonitor",sr);let Br=He.fromService(e.get(UI),i);t.registerChannel(vC,Br)}async openFirstWindow(e,t){let n=this.windowsMainService=e.get(Le);this.auxiliaryWindowsMainService=e.get(In);let i=ei(process.env)?0:4,s=this.environmentMainService.args;if(t){if(t.openables.length>0)return n.open({context:i,cli:s,urisToOpen:t.openables,gotoLineMode:!0,initialStartup:!0});if(t.urls.length>0)for(let S of t.urls){let I=new URLSearchParams(S.uri.query);if(I.get("windowId")==="_blank")return I.delete("windowId"),S.originalUrl=S.uri.toString(!0),S.uri=S.uri.with({query:I.toString()}),n.open({context:i,cli:s,forceNewWindow:!0,forceEmpty:!0,gotoLineMode:!0,initialStartup:!0})}}let a=global.macOpenFiles??[],l=s._.length,c=!!s["folder-uri"],d=!!s["file-uri"],u=s["skip-add-to-recently-opened"]===!0,f=s.wait&&s.waitMarkerFilePath?b.file(s.waitMarkerFilePath):void 0,m=s.remote||void 0,y=s.profile,v=s["profile-temp"];if(!l&&!c&&!d){if(s["new-window"]||y||v)return n.open({context:i,cli:s,forceNewWindow:!0,forceEmpty:!0,noRecentEntry:u,waitMarkerFileURI:f,initialStartup:!0,remoteAuthority:m,forceProfile:y,forceTempProfile:v});if(a.length)return n.open({context:1,cli:s,urisToOpen:a.map(S=>(S=hi(S),bi(S)?{workspaceUri:b.file(S)}:{fileUri:b.file(S)})),noRecentEntry:u,waitMarkerFileURI:f,initialStartup:!0})}return n.open({context:i,cli:s,forceNewWindow:s["new-window"],diffMode:s.diff,mergeMode:s.merge,noRecentEntry:u,waitMarkerFileURI:f,gotoLineMode:s.goto,initialStartup:!0,remoteAuthority:m,forceProfile:y,forceTempProfile:v})}afterWindowOpen(e){M&&Df(),this.installMutex(),S_.registerHttpProtocol(N.vscodeRemoteResource,(t,n)=>{n({url:t.url.replace(/^vscode-remote-resource:/,"http:"),method:t.method})}),this.resolveShellEnvironment(this.environmentMainService.args,process.env,!0),this.updateCrashReporterEnablement(),V&&ii.runningUnderARM64Translation&&this.windowsMainService?.sendToFocused("vscode:showTranslatedBuildWarning"),e.invokeFunction(t=>{let n=t.get(ot),i=()=>({idleState:Mc.getSystemIdleState(60),idleTime:Mc.getSystemIdleTime(),thermalState:Mc.getCurrentThermalState(),onBattery:Mc.isOnBatteryPower()});this._register(E.fromNodeEventEmitter(Mc,"suspend")(()=>{n.publicLog2("power.suspend",i())})),this._register(E.fromNodeEventEmitter(Mc,"resume")(()=>{n.publicLog2("power.resume",i())}))}),V&&e.invokeFunction(t=>{let n=t.get(ot);ii.getGPUFeatureStatus().skia_graphite==="enabled"&&this._register(E.fromNodeEventEmitter(ii,"child-process-gone",(a,l)=>({event:a,details:l}))(({details:a})=>{if(a.type==="GPU"&&a.reason==="crashed"){let l=ii.getGPUFeatureStatus();if(l.rasterization!=="enabled"){let d=[],u=ii;typeof u.getGPULogMessages=="function"&&(d=u.getGPULogMessages().slice(-10).map(f=>f.message)),n.publicLog2("gpu.crash.fallback",{gpuFeatureStatus:JSON.stringify(l),gpuLogMessages:JSON.stringify(d)})}}}))})}async installMutex(){let e=this.productService.win32MutexName;if(M&&e)try{let t=await import("@vscode/windows-mutex"),n=new t.Mutex(e);E.once(this.lifecycleMainService.onWillShutdown)(()=>n.release())}catch(t){this.logService.error(t)}}async resolveShellEnvironment(e,t,n){try{return await Nl(this.configurationService,this.logService,e,t)}catch(i){let s=Tr(i);n?this.windowsMainService?.sendToFocused("vscode:showResolveShellEnvError",s):this.logService.error(s)}return{}}async updateCrashReporterEnablement(){try{let t=(await this.fileService.readFile(this.environmentMainService.argvResource)).value.toString(),n=Pp(t),s=Yl(this.configurationService)>=1;if(n["enable-crash-reporter"]===void 0){let a=["","	// Allows to disable crash reporting.","	// Should restart the app if the value is changed.",`	"enable-crash-reporter": ${s},`,"","	// Unique id used for correlating crash reports sent from this instance.","	// Do not edit this value.",`	"crash-reporter-id": "${xe()}"`,"}"],l=t.substring(0,t.length-2).concat(`,
`,a.join(`
`));await this.fileService.writeFile(this.environmentMainService.argvResource,H.fromString(l))}else{let a=t.replace(/"enable-crash-reporter": .*,/,`"enable-crash-reporter": ${s},`);a!==t&&await this.fileService.writeFile(this.environmentMainService.argvResource,H.fromString(a))}}catch(e){this.logService.error(e),this.windowsMainService?.sendToFocused("vscode:showArgvParseWarning")}}eventuallyAfterWindowOpen(){pC(this.stateService,this.logService)}};ms=T([g(2,Vt),g(3,O),g(4,Fo),g(5,Te),g(6,me),g(7,ge),g(8,ft),g(9,ke),g(10,_e),g(11,Or)],ms)});function dp(o){return Object.isFrozen(o)?o:bP(o)}function hs(o,r){let{added:e,removed:t,updated:n}=E_(r?.rawConfiguration,o?.rawConfiguration),i=[],s=o?.getAllOverrideIdentifiers()||[],a=r?.getAllOverrideIdentifiers()||[];if(r){let l=a.filter(c=>!s.includes(c));for(let c of l)i.push([c,r.getKeysForOverrideIdentifier(c)])}if(o){let l=s.filter(c=>!a.includes(c));for(let c of l)i.push([c,o.getKeysForOverrideIdentifier(c)])}if(r&&o){for(let l of s)if(a.includes(l)){let c=E_({contents:o.getOverrideValue(void 0,l)||{},keys:o.getKeysForOverrideIdentifier(l)},{contents:r.getOverrideValue(void 0,l)||{},keys:r.getKeysForOverrideIdentifier(l)});i.push([l,[...c.added,...c.removed,...c.updated]])}}return{added:e,removed:t,updated:n,overrides:i}}function E_(o,r){let e=o?r?o.keys.filter(i=>r.keys.indexOf(i)===-1):[...o.keys]:[],t=r?o?r.keys.filter(i=>o.keys.indexOf(i)===-1):[...r.keys]:[],n=[];if(o&&r){for(let i of r.keys)if(o.keys.indexOf(i)!==-1){let s=xd(r.contents,i),a=xd(o.contents,i);cn(s,a)||n.push(i)}}return{added:e,removed:t,updated:n}}var Ct,mg,hg,ab,Fc,gg,lb=w(()=>{zt();Q();Zn();K();Lr();yn();We();se();st();Gi();je();jn();Ct=class o{constructor(r,e,t,n,i){this._contents=r;this._keys=e;this._overrides=t;this._raw=n;this.logService=i;this.overrideConfigurations=new Map}static createEmptyModel(r){return new o({},[],[],void 0,r)}get rawConfiguration(){if(!this._rawConfiguration)if(this._raw){let r=(Array.isArray(this._raw)?this._raw:[this._raw]).map(e=>{if(e instanceof o)return e;let t=new mg("",this.logService);return t.parseRaw(e),t.configurationModel});this._rawConfiguration=r.reduce((e,t)=>t===e?t:e.merge(t),r[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(r=>r instanceof o)))return this._raw}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(r){return r?xd(this.contents,r):this.contents}inspect(r,e){let t=this;return{get value(){return dp(t.rawConfiguration.getValue(r))},get override(){return e?dp(t.rawConfiguration.getOverrideValue(r,e)):void 0},get merged(){return dp(e?t.rawConfiguration.override(e).getValue(r):t.rawConfiguration.getValue(r))},get overrides(){let n=[];for(let{contents:i,identifiers:s,keys:a}of t.rawConfiguration.overrides){let l=new o(i,a,[],void 0,t.logService).getValue(r);l!==void 0&&n.push({identifiers:s,value:l})}return n.length?dp(n):void 0}}}getOverrideValue(r,e){let t=this.getContentsForOverrideIdentifer(e);return t?r?xd(t,r):t:void 0}getKeysForOverrideIdentifier(r){let e=[];for(let t of this.overrides)t.identifiers.includes(r)&&e.push(...t.keys);return Wr(e)}getAllOverrideIdentifiers(){let r=[];for(let e of this.overrides)r.push(...e.identifiers);return Wr(r)}override(r){let e=this.overrideConfigurations.get(r);return e||(e=this.createOverrideConfigurationModel(r),this.overrideConfigurations.set(r,e)),e}merge(...r){let e=gr(this.contents),t=gr(this.overrides),n=[...this.keys],i=this._raw?Array.isArray(this._raw)?[...this._raw]:[this._raw]:[this];for(let s of r)if(i.push(...s._raw?Array.isArray(s._raw)?s._raw:[s._raw]:[s]),!s.isEmpty()){this.mergeContents(e,s.contents);for(let a of s.overrides){let[l]=t.filter(c=>So(c.identifiers,a.identifiers));l?(this.mergeContents(l.contents,a.contents),l.keys.push(...a.keys),l.keys=Wr(l.keys)):t.push(gr(a))}for(let a of s.keys)n.indexOf(a)===-1&&n.push(a)}return new o(e,n,t,!i.length||i.every(s=>s instanceof o)?void 0:i,this.logService)}createOverrideConfigurationModel(r){let e=this.getContentsForOverrideIdentifer(r);if(!e||typeof e!="object"||!Object.keys(e).length)return this;let t={};for(let n of Wr([...Object.keys(this.contents),...Object.keys(e)])){let i=this.contents[n],s=e[n];s&&(typeof i=="object"&&typeof s=="object"?(i=gr(i),this.mergeContents(i,s)):i=s),t[n]=i}return new o(t,this.keys,this.overrides,void 0,this.logService)}mergeContents(r,e){for(let t of Object.keys(e)){if(t in r&&Je(r[t])&&Je(e[t])){this.mergeContents(r[t],e[t]);continue}r[t]=gr(e[t])}}getContentsForOverrideIdentifer(r){let e=null,t=null,n=i=>{i&&(t?this.mergeContents(t,i):t=gr(i))};for(let i of this.overrides)i.identifiers.length===1&&i.identifiers[0]===r?e=i.contents:i.identifiers.includes(r)&&n(i.contents);return n(e),t}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}addValue(r,e){this.updateValue(r,e,!0)}setValue(r,e){this.updateValue(r,e,!1)}removeValue(r){let e=this.keys.indexOf(r);e!==-1&&(this.keys.splice(e,1),R1(this.contents,r),gi.test(r)&&this.overrides.splice(this.overrides.findIndex(t=>So(t.identifiers,Ka(r))),1))}updateValue(r,e,t){if(Av(this.contents,r,e,n=>this.logService.error(n)),t=t||this.keys.indexOf(r)===-1,t&&this.keys.push(r),gi.test(r)){let n=this.contents[r],i=Ka(r),s={identifiers:i,keys:Object.keys(n),contents:mf(n,l=>this.logService.error(l))},a=this.overrides.findIndex(l=>So(l.identifiers,i));a!==-1?this.overrides[a]=s:this.overrides.push(s)}}},mg=class{constructor(r,e){this._name=r;this.logService=e;this._raw=null;this._configurationModel=null;this._restrictedConfigurations=[];this._parseErrors=[]}get configurationModel(){return this._configurationModel||Ct.createEmptyModel(this.logService)}get restrictedConfigurations(){return this._restrictedConfigurations}get errors(){return this._parseErrors}parse(r,e){if(!At(r)){let t=this.doParseContent(r);this.parseRaw(t,e)}}reparse(r){this._raw&&this.parseRaw(this._raw,r)}parseRaw(r,e){this._raw=r;let{contents:t,keys:n,overrides:i,restricted:s,hasExcludedProperties:a}=this.doParseRaw(r,e);this._configurationModel=new Ct(t,n,i,a?[r]:void 0,this.logService),this._restrictedConfigurations=s||[]}doParseContent(r){let e={},t=null,n=[],i=[],s=[];function a(c){Array.isArray(n)?n.push(c):t!==null&&(n[t]=c)}let l={onObjectBegin:()=>{let c={};a(c),i.push(n),n=c,t=null},onObjectProperty:c=>{t=c},onObjectEnd:()=>{n=i.pop()},onArrayBegin:()=>{let c=[];a(c),i.push(n),n=c,t=null},onArrayEnd:()=>{n=i.pop()},onLiteralValue:a,onError:(c,d,u)=>{s.push({error:c,offset:d,length:u})}};if(r)try{Pl(r,l),e=n[0]||{}}catch(c){this.logService.error(`Error while parsing settings file ${this._name}: ${c}`),this._parseErrors=[c]}return e}doParseRaw(r,e){let t=Tt.as(tr.Configuration),n=t.getConfigurationProperties(),i=t.getExcludedConfigurationProperties(),s=this.filter(r,n,i,!0,e);r=s.raw;let a=mf(r,d=>this.logService.error(`Conflict in settings file ${this._name}: ${d}`)),l=Object.keys(r),c=this.toOverrides(r,d=>this.logService.error(`Conflict in settings file ${this._name}: ${d}`));return{contents:a,keys:l,overrides:c,restricted:s.restricted,hasExcludedProperties:s.hasExcludedProperties}}filter(r,e,t,n,i){let s=!1;if(!i?.scopes&&!i?.skipRestricted&&!i?.skipUnregistered&&!i?.exclude?.length)return{raw:r,restricted:[],hasExcludedProperties:s};let a={},l=[];for(let c in r)if(gi.test(c)&&n){let d=this.filter(r[c],e,t,!1,i);a[c]=d.raw,s=s||d.hasExcludedProperties,l.push(...d.restricted)}else{let d=e[c];d?.restricted&&l.push(c),this.shouldInclude(c,d,t,i)?a[c]=r[c]:s=!0}return{raw:a,restricted:l,hasExcludedProperties:s}}shouldInclude(r,e,t,n){if(n.exclude?.includes(r))return!1;if(n.include?.includes(r))return!0;if(n.skipRestricted&&e?.restricted||n.skipUnregistered&&!e)return!1;let i=e??t[r],s=i?typeof i.scope<"u"?i.scope:4:void 0;return s===void 0||n.scopes===void 0?!0:n.scopes.includes(s)}toOverrides(r,e){let t=[];for(let n of Object.keys(r))if(gi.test(n)){let i={},s=r[n];for(let a in s)i[a]=s[a];t.push({identifiers:Ka(n),keys:Object.keys(i),contents:mf(i,e)})}return t}},hg=class extends C{constructor(e,t,n,i,s){super();this.userSettingsResource=e;this.parseOptions=t;this.fileService=i;this.logService=s;this._onDidChange=this._register(new x);this.onDidChange=this._onDidChange.event;this.parser=new mg(this.userSettingsResource.toString(),s),this._register(this.fileService.watch(n.dirname(this.userSettingsResource))),this._register(this.fileService.watch(this.userSettingsResource)),this._register(E.any(E.filter(this.fileService.onDidFilesChange,a=>a.contains(this.userSettingsResource)),E.filter(this.fileService.onDidRunOperation,a=>(a.isOperation(0)||a.isOperation(3)||a.isOperation(1)||a.isOperation(4))&&n.isEqual(a.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 Ct.createEmptyModel(this.logService)}}reparse(e){return e&&(this.parseOptions=e),this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}},ab=class{constructor(r,e,t,n,i,s,a,l,c,d,u,f,m){this.key=r;this.overrides=e;this._value=t;this.overrideIdentifiers=n;this.defaultConfiguration=i;this.policyConfiguration=s;this.applicationConfiguration=a;this.userConfiguration=l;this.localUserConfiguration=c;this.remoteUserConfiguration=d;this.workspaceConfiguration=u;this.folderConfigurationModel=f;this.memoryConfigurationModel=m}get value(){return dp(this._value)}toInspectValue(r){return r?.value!==void 0||r?.override!==void 0||r?.overrides!==void 0?r: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)}},Fc=class o{constructor(r,e,t,n,i,s,a,l,c,d){this._defaultConfiguration=r;this._policyConfiguration=e;this._applicationConfiguration=t;this._localUserConfiguration=n;this._remoteUserConfiguration=i;this._workspaceConfiguration=s;this._folderConfigurations=a;this._memoryConfiguration=l;this._memoryConfigurationByResource=c;this.logService=d;this._workspaceConsolidatedConfiguration=null;this._foldersConsolidatedConfigurations=new gt;this._userConfiguration=null}getValue(r,e,t){return this.getConsolidatedConfigurationModel(r,e,t).getValue(r)}updateValue(r,e,t={}){let n;t.resource?(n=this._memoryConfigurationByResource.get(t.resource),n||(n=Ct.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(t.resource,n))):n=this._memoryConfiguration,e===void 0?n.removeValue(r):n.setValue(r,e),t.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(r,e,t){let n=this.getConsolidatedConfigurationModel(r,e,t),i=this.getFolderConfigurationModelForResource(e.resource,t),s=e.resource?this._memoryConfigurationByResource.get(e.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(let l of n.overrides)for(let c of l.identifiers)n.getOverrideValue(r,c)!==void 0&&a.add(c);return new ab(r,e,n.getValue(r),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,t?this._workspaceConfiguration:void 0,i||void 0,s)}keys(r){let e=this.getFolderConfigurationModelForResource(void 0,r);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(r){this._defaultConfiguration=r,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updatePolicyConfiguration(r){this._policyConfiguration=r}updateApplicationConfiguration(r){this._applicationConfiguration=r,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateLocalUserConfiguration(r){this._localUserConfiguration=r,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateRemoteUserConfiguration(r){this._remoteUserConfiguration=r,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateWorkspaceConfiguration(r){this._workspaceConfiguration=r,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateFolderConfiguration(r,e){this._folderConfigurations.set(r,e),this._foldersConsolidatedConfigurations.delete(r)}deleteFolderConfiguration(r){this.folderConfigurations.delete(r),this._foldersConsolidatedConfigurations.delete(r)}compareAndUpdateDefaultConfiguration(r,e){let t=[];if(!e){let{added:n,updated:i,removed:s}=hs(this._defaultConfiguration,r);e=[...n,...i,...s]}for(let n of e)for(let i of Ka(n)){let s=this._defaultConfiguration.getKeysForOverrideIdentifier(i),a=r.getKeysForOverrideIdentifier(i),l=[...a.filter(c=>s.indexOf(c)===-1),...s.filter(c=>a.indexOf(c)===-1),...s.filter(c=>!cn(this._defaultConfiguration.override(i).getValue(c),r.override(i).getValue(c)))];t.push([i,l])}return this.updateDefaultConfiguration(r),{keys:e,overrides:t}}compareAndUpdatePolicyConfiguration(r){let{added:e,updated:t,removed:n}=hs(this._policyConfiguration,r),i=[...e,...t,...n];return i.length&&this.updatePolicyConfiguration(r),{keys:i,overrides:[]}}compareAndUpdateApplicationConfiguration(r){let{added:e,updated:t,removed:n,overrides:i}=hs(this.applicationConfiguration,r),s=[...e,...t,...n];return s.length&&this.updateApplicationConfiguration(r),{keys:s,overrides:i}}compareAndUpdateLocalUserConfiguration(r){let{added:e,updated:t,removed:n,overrides:i}=hs(this.localUserConfiguration,r),s=[...e,...t,...n];return s.length&&this.updateLocalUserConfiguration(r),{keys:s,overrides:i}}compareAndUpdateRemoteUserConfiguration(r){let{added:e,updated:t,removed:n,overrides:i}=hs(this.remoteUserConfiguration,r),s=[...e,...t,...n];return s.length&&this.updateRemoteUserConfiguration(r),{keys:s,overrides:i}}compareAndUpdateWorkspaceConfiguration(r){let{added:e,updated:t,removed:n,overrides:i}=hs(this.workspaceConfiguration,r),s=[...e,...t,...n];return s.length&&this.updateWorkspaceConfiguration(r),{keys:s,overrides:i}}compareAndUpdateFolderConfiguration(r,e){let t=this.folderConfigurations.get(r),{added:n,updated:i,removed:s,overrides:a}=hs(t,e),l=[...n,...i,...s];return(l.length||!t)&&this.updateFolderConfiguration(r,e),{keys:l,overrides:a}}compareAndDeleteFolderConfiguration(r){let e=this.folderConfigurations.get(r);if(!e)throw new Error("Unknown folder");this.deleteFolderConfiguration(r);let{added:t,updated:n,removed:i,overrides:s}=hs(e,void 0);return{keys:[...t,...n,...i],overrides:s}}get defaults(){return this._defaultConfiguration}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){if(!this._userConfiguration)if(this._remoteUserConfiguration.isEmpty())this._userConfiguration=this._localUserConfiguration;else{let r=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new Ct(r.contents,r.keys,r.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(r,e,t){let n=this.getConsolidatedConfigurationModelForResource(e,t);if(e.overrideIdentifier&&(n=n.override(e.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(r)!==void 0){n=n.merge();for(let i of this._policyConfiguration.keys)n.setValue(i,this._policyConfiguration.getValue(i))}return n}getConsolidatedConfigurationModelForResource({resource:r},e){let t=this.getWorkspaceConsolidatedConfiguration();if(e&&r){let n=e.getFolder(r);n&&(t=this.getFolderConsolidatedConfiguration(n.uri)||t);let i=this._memoryConfigurationByResource.get(r);i&&(t=t.merge(i))}return t}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(r){let e=this._foldersConsolidatedConfigurations.get(r);if(!e){let t=this.getWorkspaceConsolidatedConfiguration(),n=this._folderConfigurations.get(r);n?(e=t.merge(n),this._foldersConsolidatedConfigurations.set(r,e)):e=t}return e}getFolderConfigurationModelForResource(r,e){if(e&&r){let t=e.getFolder(r);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((r,e)=>{let{contents:t,overrides:n,keys:i}=this._folderConfigurations.get(e);return r.push([e,{contents:t,overrides:n,keys:i}]),r},[])}}allKeys(){let r=new Set;return this._defaultConfiguration.keys.forEach(e=>r.add(e)),this.userConfiguration.keys.forEach(e=>r.add(e)),this._workspaceConfiguration.keys.forEach(e=>r.add(e)),this._folderConfigurations.forEach(e=>e.keys.forEach(t=>r.add(t))),[...r.values()]}allOverrideIdentifiers(){let r=new Set;return this._defaultConfiguration.getAllOverrideIdentifiers().forEach(e=>r.add(e)),this.userConfiguration.getAllOverrideIdentifiers().forEach(e=>r.add(e)),this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(e=>r.add(e)),this._folderConfigurations.forEach(e=>e.getAllOverrideIdentifiers().forEach(t=>r.add(t))),[...r.values()]}getAllKeysForOverrideIdentifier(r){let e=new Set;return this._defaultConfiguration.getKeysForOverrideIdentifier(r).forEach(t=>e.add(t)),this.userConfiguration.getKeysForOverrideIdentifier(r).forEach(t=>e.add(t)),this._workspaceConfiguration.getKeysForOverrideIdentifier(r).forEach(t=>e.add(t)),this._folderConfigurations.forEach(t=>t.getKeysForOverrideIdentifier(r).forEach(n=>e.add(n))),[...e.values()]}static parse(r,e){let t=this.parseConfigurationModel(r.defaults,e),n=this.parseConfigurationModel(r.policy,e),i=this.parseConfigurationModel(r.application,e),s=this.parseConfigurationModel(r.userLocal,e),a=this.parseConfigurationModel(r.userRemote,e),l=this.parseConfigurationModel(r.workspace,e),c=r.folders.reduce((d,u)=>(d.set(b.revive(u[0]),this.parseConfigurationModel(u[1],e)),d),new gt);return new o(t,n,i,s,a,l,c,Ct.createEmptyModel(e),new gt,e)}static parseConfigurationModel(r,e){return new Ct(r.contents,r.keys,r.overrides,r.raw,e)}},gg=class{constructor(r,e,t,n,i){this.change=r;this.previous=e;this.currentConfiguraiton=t;this.currentWorkspace=n;this.logService=i;this._marker=`
`;this._markerCode1=this._marker.charCodeAt(0);this._markerCode2=46;this.affectedKeys=new Set;this._previousConfiguration=void 0;for(let s of r.keys)this.affectedKeys.add(s);for(let[,s]of r.overrides)for(let a of s)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(let s of this.affectedKeys)this._affectsConfigStr+=s+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=Fc.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(r,e){let t=this._marker+r,n=this._affectsConfigStr.indexOf(t);if(n<0)return!1;let i=n+t.length;if(i>=this._affectsConfigStr.length)return!1;let s=this._affectsConfigStr.charCodeAt(i);if(s!==this._markerCode1&&s!==this._markerCode2)return!1;if(e){let a=this.previousConfiguration?this.previousConfiguration.getValue(r,e,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(r,e,this.currentWorkspace);return!cn(a,l)}return!0}}});var vg,yg,Uc,T_=w(()=>{zt();Q();K();yn();We();lb();Gi();re();ri();jn();Ve();Zn();vg=class extends C{constructor(e){super();this.logService=e;this._onDidChangeConfiguration=this._register(new x);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._configurationModel=Ct.createEmptyModel(e)}get configurationModel(){return this._configurationModel}async initialize(){return this.resetConfigurationModel(),this._register(Tt.as(tr.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,Tt.as(tr.Configuration).getConfigurationProperties()),this._onDidChangeConfiguration.fire({defaults:this.configurationModel,properties:e})}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=Ct.createEmptyModel(this.logService);let e=Tt.as(tr.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(e),e)}updateConfigurationModel(e,t){let n=this.getConfigurationDefaultOverrides();for(let i of e){let s=n[i],a=t[i];s!==void 0?this._configurationModel.setValue(i,s):a?this._configurationModel.setValue(i,gr(a.default)):this._configurationModel.removeValue(i)}}},yg=class{constructor(){this.onDidChangeConfiguration=E.None;this.configurationModel=Ct.createEmptyModel(new jf)}async initialize(){return this.configurationModel}},Uc=class extends C{constructor(e,t,n){super();this.defaultConfiguration=e;this.policyService=t;this.logService=n;this._onDidChangeConfiguration=this._register(new x);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._configurationModel=Ct.createEmptyModel(this.logService),this.configurationRegistry=Tt.as(tr.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={},n=[],i=this.configurationRegistry.getConfigurationProperties(),s=this.configurationRegistry.getExcludedConfigurationProperties();for(let a of e){let l=i[a]??s[a];if(!l){n.push(a);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;n.push(a),t[l.policy.name]={type:l.type==="number"?"number":l.type==="boolean"?"boolean":"string",value:c}}}return zp(t)||await this.policyService.updatePolicyDefinitions(t),n}onDidChangePolicies(e){this.logService.trace("PolicyConfiguration#onDidChangePolicies",e);let t=this.configurationRegistry.getPolicyConfigurations(),n=at(e.map(i=>t.get(i)));this.update(n,!0)}update(e,t){this.logService.trace("PolicyConfiguration#update",e);let n=this.configurationRegistry.getConfigurationProperties(),i=this.configurationRegistry.getExcludedConfigurationProperties(),s=[],a=this._configurationModel.isEmpty();for(let l of e){let c=n[l]??i[l],d=c?.policy?.name;if(d){let u=this.policyService.getPolicyValue(d);if(Ae(u)&&c.type!=="string")try{u=this.parse(u)}catch(f){this.logService.error(`Error parsing policy value ${d}:`,qt(f));continue}(a?u!==void 0:!cn(this._configurationModel.getValue(l),u))&&s.push([l,u])}else this._configurationModel.getValue(l)!==void 0&&s.push([l,void 0])}if(s.length){this.logService.trace("PolicyConfiguration#changed",s);let l=this._configurationModel;this._configurationModel=Ct.createEmptyModel(this.logService);for(let c of l.keys)this._configurationModel.setValue(c,l.getValue(c));for(let[c,d]of s)d===void 0?this._configurationModel.removeValue(c):this._configurationModel.setValue(c,d);t&&this._onDidChangeConfiguration.fire(this._configurationModel)}}parse(e){let t={},n=null,i=[],s=[],a=[];function l(d){if(Array.isArray(i))i.push(d);else if(n!==null){if(i[n]!==void 0)throw new Error(`Duplicate property found: ${n}`);i[n]=d}}if(e&&(Pl(e,{onObjectBegin:()=>{let d={};l(d),s.push(i),i=d,n=null},onObjectProperty:d=>{n=d},onObjectEnd:()=>{i=s.pop()},onArrayBegin:()=>{let d=[];l(d),s.push(i),i=d,n=null},onArrayEnd:()=>{i=s.pop()},onLiteralValue:l,onError:(d,u,f)=>{a.push({error:d,offset:u,length:f})}}),t=i[0]||t),a.length>0)throw new Error(a.map(d=>qt(d.error)).join(`
`));return t}};Uc=T([g(1,An),g(2,O)],Uc)});var wg,cb,C_=w(()=>{zt();he();nt();Q();Zn();Qy();K();Lr();yn();Y();yt();st();lb();Gi();T_();je();ri();wg=class extends C{constructor(e,t,n,i){super();this.settingsResource=e;this.logService=i;this._onDidChangeConfiguration=this._register(new x);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this.defaultConfiguration=this._register(new vg(i)),this.policyConfiguration=n instanceof Ql?new yg:this._register(new Uc(this.defaultConfiguration,n,i)),this.userConfiguration=this._register(new hg(this.settingsResource,{},Ge,t,i)),this.configuration=new Fc(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,Ct.createEmptyModel(i),Ct.createEmptyModel(i),Ct.createEmptyModel(i),Ct.createEmptyModel(i),new gt,Ct.createEmptyModel(i),new gt,i),this.configurationEditing=new cb(e,t,this),this.reloadConfigurationScheduler=this._register(new pr(()=>this.reloadConfiguration(),50)),this._register(this.defaultConfiguration.onDidChangeConfiguration(({defaults:s,properties:a})=>this.onDidDefaultConfigurationChange(s,a))),this._register(this.policyConfiguration.onDidChangeConfiguration(s=>this.onDidPolicyConfigurationChange(s))),this._register(this.userConfiguration.onDidChange(()=>this.reloadConfigurationScheduler.schedule()))}async initialize(){let[e,t,n]=await Promise.all([this.defaultConfiguration.initialize(),this.policyConfiguration.initialize(),this.userConfiguration.loadConfiguration()]);this.configuration=new Fc(e,t,Ct.createEmptyModel(this.logService),n,Ct.createEmptyModel(this.logService),Ct.createEmptyModel(this.logService),new gt,Ct.createEmptyModel(this.logService),new gt,this.logService)}getConfigurationData(){return this.configuration.toData()}getValue(e,t){let n=typeof e=="string"?e:void 0,i=ff(e)?e:ff(t)?t:{};return this.configuration.getValue(n,i,void 0)}async updateValue(e,t,n,i,s){let a=k1(n)?n:ff(n)?{resource:n.resource,overrideIdentifiers:n.overrideIdentifier?[n.overrideIdentifier]:void 0}:void 0,l=a?i:n;if(l!==void 0&&l!==3&&l!==2)throw new Error(`Unable to write ${e} to target ${l}.`);a?.overrideIdentifiers&&(a.overrideIdentifiers=Wr(a.overrideIdentifiers),a.overrideIdentifiers=a.overrideIdentifiers.length?a.overrideIdentifiers:void 0);let c=this.inspect(e,{resource:a?.resource,overrideIdentifier:a?.overrideIdentifiers?a.overrideIdentifiers[0]:void 0});if(c.policyValue!==void 0)throw new Error(`Unable to write ${e} because it is configured in system policy.`);if(cn(t,c.defaultValue)&&(t=void 0),a?.overrideIdentifiers?.length&&a.overrideIdentifiers.length>1){let u=a.overrideIdentifiers.sort(),f=this.configuration.localUserConfiguration.overrides.find(m=>So([...m.identifiers].sort(),u));f&&(a.overrideIdentifiers=f.identifiers)}let d=a?.overrideIdentifiers?.length?[N1(a.overrideIdentifiers),e]:[e];await this.configurationEditing.write(d,t),await this.reloadConfiguration()}inspect(e,t={}){return this.configuration.inspect(e,t,void 0)}keys(){return this.configuration.keys(void 0)}async reloadConfiguration(){let e=await this.userConfiguration.loadConfiguration();this.onDidChangeUserConfiguration(e)}onDidChangeUserConfiguration(e){let t=this.configuration.toData(),n=this.configuration.compareAndUpdateLocalUserConfiguration(e);this.trigger(n,t,2)}onDidDefaultConfigurationChange(e,t){let n=this.configuration.toData(),i=this.configuration.compareAndUpdateDefaultConfiguration(e,t);this.trigger(i,n,7)}onDidPolicyConfigurationChange(e){let t=this.configuration.toData(),n=this.configuration.compareAndUpdatePolicyConfiguration(e);this.trigger(n,t,7)}trigger(e,t,n){let i=new gg(e,{data:t},this.configuration,void 0,this.logService);i.source=n,this._onDidChangeConfiguration.fire(i)}},cb=class{constructor(r,e,t){this.settingsResource=r;this.fileService=e;this.configurationService=t;this.queue=new Cn}write(r,e){return this.queue.queue(()=>this.doWriteConfiguration(r,e))}async doWriteConfiguration(r,e){let t;try{t=(await this.fileService.readFile(this.settingsResource)).value.toString()}catch(s){if(s.fileOperationResult===1)t="{}";else throw s}let n=[];if(Rn(t,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 i=this.getEdits(t,r,e);t=Jy(t,i),await this.fileService.writeFile(this.settingsResource,H.fromString(t))}getEdits(r,e,t){let{tabSize:n,insertSpaces:i,eol:s}=this.formattingOptions;if(!e.length){let a=JSON.stringify(t,null,i?" ".repeat(n):"	");return[{content:a,length:a.length,offset:0}]}return jy(r,e,t,{tabSize:n,insertSpaces:i,eol:s})}get formattingOptions(){if(!this._formattingOptions){let r=Lt===3||Lt===2?`
`:`\r
`,e=this.configurationService.getValue("files.eol",{overrideIdentifier:"jsonc"});e&&typeof e=="string"&&e!=="auto"&&(r=e),this._formattingOptions={eol:r,insertSpaces:!!this.configurationService.getValue("editor.insertSpaces",{overrideIdentifier:"jsonc"}),tabSize:this.configurationService.getValue("editor.tabSize",{overrideIdentifier:"jsonc"})}}return this._formattingOptions}}});import*as k_ from"fs";import*as Ht from"os";async function db(o,r){let e=`${o}::${r.join(":")}`,t=__.get(e);if(t)return t;let n=[{tag:"grunt.js",filePattern:/^gruntfile\.js$/i},{tag:"gulp.js",filePattern:/^gulpfile\.js$/i},{tag:"tsconfig.json",filePattern:/^tsconfig\.json$/i},{tag:"package.json",filePattern:/^package\.json$/i},{tag:"jsconfig.json",filePattern:/^jsconfig\.json$/i},{tag:"tslint.json",filePattern:/^tslint\.json$/i},{tag:"eslint.json",filePattern:/^eslint\.json$/i},{tag:"tasks.json",filePattern:/^tasks\.json$/i},{tag:"launch.json",filePattern:/^launch\.json$/i},{tag:"mcp.json",filePattern:/^mcp\.json$/i},{tag:"settings.json",filePattern:/^settings\.json$/i},{tag:"webpack.config.js",filePattern:/^webpack\.config\.js$/i},{tag:"project.json",filePattern:/^project\.json$/i},{tag:"makefile",filePattern:/^makefile$/i},{tag:"sln",filePattern:/^.+\.sln$/i},{tag:"csproj",filePattern:/^.+\.csproj$/i},{tag:"cmake",filePattern:/^.+\.cmake$/i},{tag:"github-actions",filePattern:/^.+\.ya?ml$/i,relativePathPattern:/^\.github(?:\/|\\)workflows$/i},{tag:"devcontainer.json",filePattern:/^devcontainer\.json$/i},{tag:"dockerfile",filePattern:/^(dockerfile|docker\-compose\.ya?ml)$/i},{tag:"cursorrules",filePattern:/^\.cursorrules$/i},{tag:"cursorrules-dir",filePattern:/\.mdc$/i,relativePathPattern:/^\.cursor[\/\\]rules$/i},{tag:"github-instructions-dir",filePattern:/\.instructions\.md$/i,relativePathPattern:/^\.github[\/\\]instructions$/i},{tag:"github-prompts-dir",filePattern:/\.prompt\.md$/i,relativePathPattern:/^\.github[\/\\]prompts$/i},{tag:"clinerules",filePattern:/^\.clinerules$/i},{tag:"clinerules-dir",filePattern:/\.md$/i,relativePathPattern:/^\.clinerules$/i},{tag:"agent.md",filePattern:/^agent\.md$/i},{tag:"agents.md",filePattern:/^agents\.md$/i},{tag:"claude.md",filePattern:/^claude\.md$/i},{tag:"claude-settings",filePattern:/^settings\.json$/i,relativePathPattern:/^\.claude$/i},{tag:"claude-settings-local",filePattern:/^settings\.local\.json$/i,relativePathPattern:/^\.claude$/i},{tag:"claude-mcp",filePattern:/^mcp\.json$/i,relativePathPattern:/^\.claude$/i},{tag:"claude-commands-dir",filePattern:/\.md$/i,relativePathPattern:/^\.claude[\/\\]commands$/i},{tag:"claude-skills-dir",filePattern:/^SKILL\.md$/i,relativePathPattern:/^\.claude[\/\\]skills[\/\\]/i},{tag:"claude-rules-dir",filePattern:/\.md$/i,relativePathPattern:/^\.claude[\/\\]rules$/i},{tag:"gemini.md",filePattern:/^gemini\.md$/i},{tag:"copilot-instructions.md",filePattern:/^copilot\-instructions\.md$/i,relativePathPattern:/^\.github$/i}],i=new Map,s=new Map,a=2e4;function l(d,u,f,m){let y=u.substring(d.length+1);return wt.withAsyncBody(async v=>{let S;m.readdirCount++;try{S=await q.readdir(u,{withFileTypes:!0})}catch{v();return}if(m.count>=a){m.count+=S.length,m.maxReached=!0,v();return}let I=S.length;if(I===0){v();return}let k=S;m.count+S.length>a&&(m.maxReached=!0,I=a-m.count,k=S.slice(0,I)),m.count+=S.length;for(let R of k)if(R.isDirectory()){if(f.includes(R.name)||await l(d,U(u,R.name),f,m),--I===0){v();return}}else{let D=R.name.lastIndexOf(".");if(D>=0){let F=R.name.substring(D+1);F&&i.set(F,(i.get(F)??0)+1)}for(let F of n)F.relativePathPattern?.test(y)!==!1&&F.filePattern.test(R.name)&&s.set(F.tag,(s.get(F.tag)??0)+1);if(--I===0){v();return}}})}let c=wt.withAsyncBody(async d=>{let u={count:0,maxReached:!1,readdirCount:0},f=new sn(!0);await l(o,o,r,u);let m=await wM(o);d({configFiles:ub(s),fileTypes:ub(i),fileCount:u.count,maxFilesReached:u.maxReached,launchConfigFiles:m,totalScanTime:f.elapsed(),totalReaddirCount:u.readdirCount})});return __.set(e,c),c}function ub(o){return Array.from(o.entries(),([r,e])=>({name:r,count:e})).sort((r,e)=>e.count-r.count)}function yM(){let o={os:`${Ht.type()} ${Ht.arch()} ${Ht.release()}`,memory:`${(Ht.totalmem()/Ii.GB).toFixed(2)}GB (${(Ht.freemem()/Ii.GB).toFixed(2)}GB free)`,vmHint:`${Math.round(Uu.value()*100)}%`},r=Ht.cpus();return r&&r.length>0&&(o.cpus=`${r[0].model} (${r.length} x ${r[0].speed})`),o}async function wM(o){try{let r=new Map,e=U(o,".vscode","launch.json"),t=await k_.promises.readFile(e),n=[],i=Rn(t.toString(),n);if(n.length)return console.log(`Unable to parse ${e}`),[];if(Go(i)==="object"&&i.configurations)for(let s of i.configurations){let a=s.type;a&&(r.has(a)?r.set(a,r.get(a)+1):r.set(a,1))}return ub(r)}catch{return[]}}var __,Nc,R_=w(()=>{he();Zn();ze();Se();Y();xs();se();Nu();jt();Bw();Em();je();Qt();ir();__=new Map;Nc=class{constructor(r,e){this.telemetryService=r;this.productService=e}formatMachineInfo(r){let e=[];return e.push(`OS Version:       ${r.os}`),e.push(`CPUs:             ${r.cpus}`),e.push(`Memory (System):  ${r.memory}`),e.push(`VM:               ${r.vmHint}`),e.join(`
`)}formatEnvironment(r){let e=[];e.push(`Version:          ${this.productService.nameShort} ${this.productService.version} (${this.productService.commit||"Commit unknown"}, ${this.productService.date||"Date unknown"})`),e.push(`OS Version:       ${Ht.type()} ${Ht.arch()} ${Ht.release()}`);let t=Ht.cpus();return t&&t.length>0&&e.push(`CPUs:             ${t[0].model} (${t.length} x ${t[0].speed})`),e.push(`Memory (System):  ${(Ht.totalmem()/Ii.GB).toFixed(2)}GB (${(Ht.freemem()/Ii.GB).toFixed(2)}GB free)`),M||e.push(`Load (avg):       ${Ht.loadavg().map(n=>Math.round(n)).join(", ")}`),e.push(`VM:               ${Math.round(Uu.value()*100)}%`),e.push(`Screen Reader:    ${r.screenReader?"yes":"no"}`),e.push(`Process Argv:     ${r.mainArguments.join(" ")}`),e.push(`GPU Status:       ${this.expandGPUFeatures(r.gpuFeatureStatus)}`),r.gpuLogMessages&&r.gpuLogMessages.length>0&&(e.push("GPU Log Messages:"),r.gpuLogMessages.forEach(n=>{e.push(`${n.header}: ${n.message}`)})),e.join(`
`)}async getPerformanceInfo(r,e){return Promise.all([Fu(r.mainPID),this.formatWorkspaceMetadata(r)]).then(async t=>{let[n,i]=t,s=this.formatProcessList(r,n);return e.forEach(a=>{if(Iu(a))s+=`
${a.errorMessage}`,i+=`
${a.errorMessage}`;else if(s+=`

Remote: ${a.hostName}`,a.processes&&(s+=`
${this.formatProcessList(r,a.processes)}`),a.workspaceMetadata){i+=`
|  Remote: ${a.hostName}`;for(let l of Object.keys(a.workspaceMetadata)){let c=a.workspaceMetadata[l],d=`${c.fileCount} files`;c.maxFilesReached&&(d=`more than ${d}`),i+=`|    Folder (${l}): ${d}`,i+=this.formatWorkspaceStats(c)}}}),{processInfo:s,workspaceInfo:i}})}async getSystemInfo(r,e){let{memory:t,vmHint:n,os:i,cpus:s}=yM(),a={os:i,memory:t,cpus:s,vmHint:n,processArgs:`${r.mainArguments.join(" ")}`,gpuStatus:r.gpuFeatureStatus,screenReader:`${r.screenReader?"yes":"no"}`,remoteData:e};return M||(a.load=`${Ht.loadavg().map(l=>Math.round(l)).join(", ")}`),ne&&(a.linuxEnv={desktopSession:process.env.DESKTOP_SESSION,xdgSessionDesktop:process.env.XDG_SESSION_DESKTOP,xdgCurrentDesktop:process.env.XDG_CURRENT_DESKTOP,xdgSessionType:process.env.XDG_SESSION_TYPE}),Promise.resolve(a)}async getDiagnostics(r,e){let t=[];return Fu(r.mainPID).then(async n=>(t.push(""),t.push(this.formatEnvironment(r)),t.push(""),t.push(this.formatProcessList(r,n)),r.windows.some(i=>i.folderURIs&&i.folderURIs.length>0&&!i.remoteAuthority)&&(t.push(""),t.push("Workspace Stats: "),t.push(await this.formatWorkspaceMetadata(r))),e.forEach(i=>{if(Iu(i))t.push(`
${i.errorMessage}`);else if(t.push(`

`),t.push(`Remote:           ${i.hostName}`),t.push(this.formatMachineInfo(i.machineInfo)),i.processes&&t.push(this.formatProcessList(r,i.processes)),i.workspaceMetadata)for(let s of Object.keys(i.workspaceMetadata)){let a=i.workspaceMetadata[s],l=`${a.fileCount} files`;a.maxFilesReached&&(l=`more than ${l}`),t.push(`Folder (${s}): ${l}`),t.push(this.formatWorkspaceStats(a))}}),t.push(""),t.push(""),t.join(`
`)))}formatWorkspaceStats(r){let e=[],n=0,i=(c,d)=>{let u=` ${c}(${d})`;n+u.length>60?(e.push(s),s="|                 ",n=s.length):n+=u.length,s+=u},s="|      File types:",a=10,l=r.fileTypes.length>a?a:r.fileTypes.length;for(let c=0;c<l;c++){let d=r.fileTypes[c];i(d.name,d.count)}if(e.push(s),r.configFiles.length>=0&&(s="|      Conf files:",n=0,r.configFiles.forEach(c=>{i(c.name,c.count)}),e.push(s)),r.launchConfigFiles.length>0){let c="|      Launch Configs:";r.launchConfigFiles.forEach(d=>{let u=d.count>1?` ${d.name}(${d.count})`:` ${d.name}`;c+=u}),e.push(c)}return e.join(`
`)}expandGPUFeatures(r){let e=Math.max(...Object.keys(r).map(t=>t.length));return Object.keys(r).map(t=>`${t}:  ${" ".repeat(e-t.length)}  ${r[t]}`).join(`
                  `)}formatWorkspaceMetadata(r){let e=[],t=[];return r.windows.forEach(n=>{n.folderURIs.length===0||n.remoteAuthority||(e.push(`|  Window (${n.title})`),n.folderURIs.forEach(i=>{let s=b.revive(i);if(s.scheme===N.file){let a=s.fsPath;t.push(db(a,["node_modules",".git"]).then(l=>{let c=`${l.fileCount} files`;l.maxFilesReached&&(c=`more than ${c}`),e.push(`|    Folder (${ye(a)}): ${c}`),e.push(this.formatWorkspaceStats(l))}).catch(l=>{e.push(`|      Error: Unable to collect workspace stats for folder ${a} (${l.toString()})`)}))}else e.push(`|    Folder (${s.toString()}): Workspace stats not available.`)}))}),Promise.all(t).then(n=>e.join(`
`)).catch(n=>`Unable to collect workspace stats: ${n}`)}formatProcessList(r,e){let t=new Map;r.windows.forEach(i=>t.set(i.pid,`window [${i.id}] (${i.title})`)),r.pidToNames.forEach(({pid:i,name:s})=>t.set(i,s));let n=[];return n.push("CPU %	Mem MB	   PID	Process"),e&&this.formatProcessItem(r.mainPID,t,n,e,0),n.join(`
`)}formatProcessItem(r,e,t,n,i){let s=i===0,a;s?a=n.pid===r?this.productService.applicationName:"remote-server":e.has(n.pid)?a=e.get(n.pid):a=`${"  ".repeat(i)} ${n.name}`;let l=process.platform==="win32"?n.mem:Ht.totalmem()*(n.mem/100);t.push(`${n.load.toFixed(0).padStart(5," ")}	${(l/Ii.MB).toFixed(0).padStart(6," ")}	${n.pid.toFixed(0).padStart(6," ")}	${a}`),Array.isArray(n.children)&&n.children.forEach(c=>this.formatProcessItem(r,e,t,c,i+1))}async getWorkspaceFileExtensions(r){let e=new Set;for(let{uri:t}of r.folders){let n=b.revive(t);if(n.scheme!==N.file)continue;let i=n.fsPath;try{(await db(i,["node_modules",".git"])).fileTypes.forEach(a=>e.add(a.name))}catch{}}return{extensions:[...e]}}async reportWorkspaceStats(r){for(let{uri:e}of r.folders){let t=b.revive(e);if(t.scheme!==N.file)continue;let n=t.fsPath;try{let i=await db(n,["node_modules",".git"]);this.telemetryService.publicLog2("workspace.stats",{"workspace.id":r.telemetryId,rendererSessionId:r.rendererSessionId}),i.fileTypes.forEach(s=>{this.telemetryService.publicLog2("workspace.stats.file",{rendererSessionId:r.rendererSessionId,type:s.name,count:s.count})}),i.launchConfigFiles.forEach(s=>{this.telemetryService.publicLog2("workspace.stats.launchConfigFile",{rendererSessionId:r.rendererSessionId,type:s.name,count:s.count})}),i.configFiles.forEach(s=>{this.telemetryService.publicLog2("workspace.stats.configFiles",{rendererSessionId:r.rendererSessionId,type:s.name,count:s.count})}),this.telemetryService.publicLog2("workspace.stats.metadata",{duration:i.totalScanTime,reachedLimit:i.maxFilesReached,fileCount:i.fileCount,readdirCount:i.totalReaddirCount})}catch{}}}};Nc=T([g(0,ot),g(1,_e)],Nc)});import{writeFileSync as IM}from"fs";import{tmpdir as bM}from"os";function D_(o){let r=Ts(bM());try{return IM(r,""),o&&console.log(`Marker file for --wait created: ${r}`),r}catch(e){o&&console.error(`Failed to create marker file for --wait: ${e}`);return}}var W_=w(()=>{an()});var gs,L_=w(()=>{zt();he();nt();St();Q();yi();sd();K();Ns();ze();ai();yt();qa();Ce();je();Fw();re();Ve();gs=class extends C{constructor(e){super();this.logService=e;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new x);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new x);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new x);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new x);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new x);this._onDidUncorrelatedFilesChange=this._register(new x);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new x);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new Ua)}registerProvider(e,t){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);Ne(`code/registerFilesystem/${e}`);let n=new te;return this.provider.set(e,t),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:t}),n.add(t.onDidChangeFile(i=>{let s=new Qf(i,!this.isPathCaseSensitive(t));this.internalOnDidFilesChange.fire(s),s.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(s)})),typeof t.onDidWatchError=="function"&&n.add(t.onDidWatchError(i=>this._onDidWatchError.fire(new Error(i)))),n.add(t.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:t,scheme:e}))),j(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:t}),this.provider.delete(e),pt(n)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){let t=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(n){t.push(n)}}),!this.provider.has(e)&&await wt.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 n=this.provider.get(e.scheme);return!!(n&&n.capabilities&t)}listCapabilities(){return pi.map(this.provider,([e,t])=>({scheme:e,capabilities:t.capabilities}))}async withProvider(e){if(!a1(e))throw new Jt(h(2086,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let t=this.provider.get(e.scheme);if(!t){let n=new on;throw n.message=h(2088,null,e.toString()),n}return t}async withReadProvider(e){let t=await this.withProvider(e);if(eo(t)||vn(t)||Yf(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(eo(t)||vn(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(n){throw ou(n)==="EntryNotFound"?new Jt(h(2083,null,this.resourceForError(e)),1):to(n)}}async doResolveFile(e,t){let n=await this.withProvider(e),i=this.isPathCaseSensitive(n),s=t?.resolveTo,a=t?.resolveSingleChildDescendants,l=t?.resolveMetadata,c=await n.stat(e),d;return this.toFileStat(n,e,c,void 0,!!l,(u,f)=>(d||(d=zr.forUris(()=>!i),d.set(e,!0),s&&d.fill(!0,s)),d.get(u.resource)||d.findSuperstr(u.resource.with({query:null,fragment:null}))?!0:u.isDirectory&&a?f===1:!1))}async toFileStat(e,t,n,i,s,a){let{providerExtUri:l}=this.getExtUri(e),c={resource:t,name:l.basename(t),isFile:(n.type&1)!==0,isDirectory:(n.type&2)!==0,isSymbolicLink:(n.type&64)!==0,mtime:n.mtime,ctime:n.ctime,size:n.size,readonly:!!((n.permissions??0)&1)||!!(e.capabilities&2048),locked:!!((n.permissions??0)&2),executable:!!((n.permissions??0)&4),etag:wy({mtime:n.mtime,size:n.size}),children:void 0};if(c.isDirectory&&a(c,i)){try{let d=await e.readdir(t),u=await wt.settled(d.map(async([f,m])=>{try{let y=l.joinPath(t,f),v=s?await e.stat(y):{type:m};return await this.toFileStat(e,y,v,d.length,s,a)}catch(y){return this.logService.trace(y),null}}));c.children=at(u)}catch(d){this.logService.trace(d),c.children=[]}return c}return c}async resolveAll(e){return wt.settled(e.map(async t=>{try{return{stat:await this.doResolveFile(t.resource,t.options),success:!0}}catch(n){return this.logService.trace(n),{stat:void 0,success:!1}}}))}async stat(e){let t=await this.withProvider(e),n=await t.stat(e);return this.toFileStat(t,e,n,void 0,!0,()=>!1)}async realpath(e){let t=await this.withProvider(e);if(Kx(t)){let n=await t.realpath(e);return e.with({path:n})}}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(n){return n}return!0}async doValidateCreateFile(e,t){if(!t?.overwrite&&await this.exists(e))throw new Jt(h(2079,null,this.resourceForError(e)),3,t)}async createFile(e,t=H.fromString(""),n){await this.doValidateCreateFile(e,n);let i=await this.writeFile(e,t);return this._onDidRunOperation.fire(new Zi(e,0,i)),i}async writeFile(e,t,n){let i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:s}=this.getExtUri(i),a=n;if(yy(i)&&!a?.atomic){let l=i.enforceAtomicWriteFile?.(e);l&&(a={...n,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(i,e,t,a);l||await this.mkdirp(i,s.dirname(e)),c||(c=await this.peekBufferForWriting(i,t)),!eo(i)||vn(i)&&c instanceof H||vn(i)&&yy(i)&&a?.atomic?await this.doWriteUnbuffered(i,e,a,c):await this.doWriteBuffered(i,e,a,c instanceof H?Z1(c):c),this._onDidRunOperation.fire(new Zi(e,4))}catch(l){throw new Jt(h(2078,null,this.resourceForError(e),to(l).toString()),jr(l),a)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,t){let n;if(vn(e)&&!(t instanceof H))if(kd(t)){let i=await J1(t,3);i.ended?n=H.concat(i.buffer):n=i}else n=j1(t,i=>H.concat(i),3);else n=t;return n}async validateWriteFile(e,t,n,i){let s=!!i?.unlock;if(s&&!(e.capabilities&8192))throw new Error(h(2096,null,this.resourceForError(t)));if(i?.append&&!Hx(e))throw new Jt(h(2075,null,this.resourceForError(t)),6);if(!!i?.atomic){if(!(e.capabilities&32768))throw new Error(h(2094,null,this.resourceForError(t)));if(!(e.capabilities&2))throw new Error(h(2095,null,this.resourceForError(t)));if(s)throw new Error(h(2093,null,this.resourceForError(t)))}let l;try{l=await e.stat(t)}catch{return Object.create(null)}if((l.type&2)!==0)throw new Jt(h(2081,null,this.resourceForError(t)),0,i);this.throwIfFileIsReadonly(t,l);let c;if(typeof i?.mtime=="number"&&typeof i.etag=="string"&&i.etag!==tm&&typeof l.mtime=="number"&&typeof l.size=="number"&&i.mtime<l.mtime&&i.etag!==wy({mtime:i.mtime,size:l.size})){if(c=await this.peekBufferForWriting(e,n),c instanceof H&&c.byteLength===l.size)try{let{value:d}=await this.readFile(t,{limits:{size:l.size}});if(c.equals(d))return{stat:l,buffer:c}}catch{}throw new Jt(h(2082,null),3,i)}return{stat:l,buffer:c}}async readFile(e,t,n){let i=await this.withReadProvider(e);return t?.atomic?this.doReadFileAtomic(i,e,t,n):this.doReadFile(i,e,t,n)}async doReadFileAtomic(e,t,n,i){return new Promise((s,a)=>{this.writeQueue.queueFor(t,async()=>{try{let l=await this.doReadFile(e,t,n,i);s(l)}catch(l){a(l)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,t,n,i){let s=await this.doReadFileStream(e,t,{...n,preferUnbuffered:!0},i);return{...s,value:await Ds(s.value)}}async readFileStream(e,t,n){let i=await this.withReadProvider(e);return this.doReadFileStream(i,e,t,n)}async doReadFileStream(e,t,n,i){let s=new qe(i),a=n;Zf(e)&&e.enforceAtomicReadFile?.(t)&&(a={...n,atomic:!0});let l=this.validateReadFile(t,a).then(d=>d,d=>{throw s.dispose(!0),d}),c;try{return typeof a?.etag=="string"&&a.etag!==tm&&await l,a?.atomic&&Zf(e)||!(eo(e)||Yf(e))||vn(e)&&a?.preferUnbuffered?c=this.readFileUnbuffered(e,t,a):Yf(e)?c=this.readFileStreamed(e,t,s.token,a):c=this.readFileBuffered(e,t,s.token,a),c.on("end",()=>s.dispose()),c.on("error",()=>s.dispose()),{...await l,value:c}}catch(d){throw c&&await Pf(c),this.restoreReadError(d,t,a)}}restoreReadError(e,t,n){let i=h(2076,null,this.resourceForError(t),to(e).toString());return e instanceof ll?new ll(i,e.stat,n):e instanceof al?new al(i,e.fileOperationResult,e.size,e.options):new Jt(i,jr(e),n)}readFileStreamed(e,t,n,i=Object.create(null)){let s=e.readFileStream(t,i,n);return Ef(s,{data:a=>a instanceof H?a:H.wrap(a),error:a=>this.restoreReadError(a,t,i)},a=>H.concat(a))}readFileBuffered(e,t,n,i=Object.create(null)){let s=rx();return rh(e,t,s,a=>a,{...i,bufferSize:this.BUFFER_SIZE,errorTransformer:a=>this.restoreReadError(a,t,i)},n),s}readFileUnbuffered(e,t,n){let i=Do(s=>H.concat(s));return(async()=>{try{let s;n?.atomic&&Zf(e)?s=await e.readFile(t,{atomic:!0}):s=await e.readFile(t),typeof n?.position=="number"&&(s=s.slice(n.position)),typeof n?.length=="number"&&(s=s.slice(0,n.length)),this.validateReadFileLimits(t,s.byteLength,n),i.end(H.wrap(s))}catch(s){i.error(s),i.end()}})(),i}async validateReadFile(e,t){let n=await this.resolve(e,{resolveMetadata:!0});if(n.isDirectory)throw new Jt(h(2080,null,this.resourceForError(e)),0,t);if(typeof t?.etag=="string"&&t.etag!==tm&&t.etag===n.etag)throw new ll(h(2084,null),n,t);return this.validateReadFileLimits(e,n.size,t),n}validateReadFileLimits(e,t,n){if(typeof n?.limits?.size=="number"&&t>n.limits.size)throw new al(h(2085,null,this.resourceForError(e)),7,t,n)}async canMove(e,t,n){return this.doCanMoveCopy(e,t,"move",n)}async canCopy(e,t,n){return this.doCanMoveCopy(e,t,"copy",n)}async doCanMoveCopy(e,t,n,i){if(e.toString()!==t.toString())try{let s=n==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),a=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t);await this.doValidateMoveCopy(s,e,a,t,n,i)}catch(s){return s}return!0}async move(e,t,n){let i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),a=await this.doMoveCopy(i,e,s,t,"move",!!n),l=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new Zi(e,a==="move"?2:3,l)),l}async copy(e,t,n){let i=await this.withReadProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),a=await this.doMoveCopy(i,e,s,t,"copy",!!n),l=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new Zi(e,a==="copy"?3:2,l)),l}async doMoveCopy(e,t,n,i,s,a){if(t.toString()===i.toString())return s;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(e,t,n,i,s,a);if(l&&!c&&a&&await this.del(i,{recursive:!0}),await this.mkdirp(n,this.getExtUri(n).providerExtUri.dirname(i)),s==="copy"){if(e===n&&iu(e))await e.copy(t,i,{overwrite:a});else{let d=await this.resolve(t);d.isDirectory?await this.doCopyFolder(e,d,n,i):await this.doCopyFile(e,t,n,i)}return s}else return e===n?(await e.rename(t,i,{overwrite:a}),s):(await this.doMoveCopy(e,t,n,i,"copy",a),await this.del(t,{recursive:!0}),"copy")}async doCopyFile(e,t,n,i){if(eo(e)&&eo(n))return this.doPipeBuffered(e,t,n,i);if(eo(e)&&vn(n))return this.doPipeBufferedToUnbuffered(e,t,n,i);if(vn(e)&&eo(n))return this.doPipeUnbufferedToBuffered(e,t,n,i);if(vn(e)&&vn(n))return this.doPipeUnbuffered(e,t,n,i)}async doCopyFolder(e,t,n,i){await n.mkdir(i),Array.isArray(t.children)&&await wt.settled(t.children.map(async s=>{let a=this.getExtUri(n).providerExtUri.joinPath(i,s.name);return s.isDirectory?this.doCopyFolder(e,await this.resolve(s.resource),n,a):this.doCopyFile(e,s.resource,n,a)}))}async doValidateMoveCopy(e,t,n,i,s,a){let l=!1;if(e===n){let{providerExtUri:d,isPathCaseSensitive:u}=this.getExtUri(e);if(u||(l=d.isEqual(t,i)),l&&s==="copy")throw new Error(h(2089,null,this.resourceForError(t),this.resourceForError(i)));if(!l&&d.isEqualOrParent(i,t))throw new Error(h(2090,null,this.resourceForError(t),this.resourceForError(i)))}let c=await this.exists(i);if(c&&!l){if(!a)throw new Jt(h(2091,null,this.resourceForError(t),this.resourceForError(i)),4);if(e===n){let{providerExtUri:d}=this.getExtUri(e);if(d.isEqualOrParent(t,i))throw new Error(h(2092,null,this.resourceForError(t),this.resourceForError(i)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let t=this.isPathCaseSensitive(e);return{providerExtUri:t?Me:Oa,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 n=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new Zi(e,0,n)),n}async mkdirp(e,t){let n=[],{providerExtUri:i}=this.getExtUri(e);for(;!i.isEqual(t,i.dirname(t));)try{if(((await e.stat(t)).type&2)===0)throw new Error(h(2087,null,this.resourceForError(t)));break}catch(s){if(ou(s)!=="EntryNotFound")throw s;n.push(i.basename(t)),t=i.dirname(t)}for(let s=n.length-1;s>=0;s--){t=i.joinPath(t,n[s]);try{await e.mkdir(t)}catch(a){if(ou(a)!=="EntryExists")throw a}}}async canDelete(e,t){try{await this.doValidateDelete(e,t)}catch(n){return n}return!0}async doValidateDelete(e,t){let n=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),i=!!t?.useTrash;if(i&&!(n.capabilities&4096))throw new Error(h(2074,null,this.resourceForError(e)));let s=t?.atomic;if(s&&!(n.capabilities&65536))throw new Error(h(2070,null,this.resourceForError(e)));if(i&&s)throw new Error(h(2073,null,this.resourceForError(e)));let a;try{a=await n.stat(e)}catch{}if(a)this.throwIfFileIsReadonly(e,a);else throw new Jt(h(2072,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(h(2071,null,this.resourceForError(e)))}return n}async del(e,t){let n=await this.doValidateDelete(e,t),i=t;if($x(n)&&!i?.atomic){let c=n.enforceAtomicDelete?.(e);c&&(i={...t,atomic:c})}let s=!!i?.useTrash,a=!!i?.recursive,l=i?.atomic??!1;await n.delete(e,{recursive:a,useTrash:s,atomic:l}),this._onDidRunOperation.fire(new Zi(e,1))}async cloneFile(e,t){let n=await this.withProvider(e),i=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t);if(!(n===i&&this.getExtUri(n).providerExtUri.isEqual(e,t)))return n===i&&Xf(n)?n.cloneFile(e,t):(await this.mkdirp(i,this.getExtUri(i).providerExtUri.dirname(t)),n===i&&iu(n)?this.writeQueue.queueFor(e,()=>n.copy(e,t,{overwrite:!0}),this.getExtUri(n).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(n,e,i,t),this.getExtUri(n).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,t){return this.watch(e,{...t,correlationId:gs.WATCHER_CORRELATION_IDS++})}watch(e,t={recursive:!1,excludes:[]}){let n=new te,i=!1,s=()=>{i=!0};n.add(j(()=>s())),(async()=>{try{let l=await this.doWatch(e,t);i?pt(l):s=()=>pt(l)}catch(l){this.logService.error(l)}})();let a=t.correlationId;if(typeof a=="number"){let l=n.add(new x);return n.add(this.internalOnDidFilesChange.event(d=>{d.correlates(a)&&l.fire(d)})),{onDidChange:l.event,dispose:()=>n.dispose()}}return n}async doWatch(e,t){let n=await this.withProvider(e),i=rr([this.getExtUri(n).providerExtUri.getComparisonKey(e),t]),s=this.activeWatchers.get(i);return s||(s={count:0,disposable:n.watch(e,t)},this.activeWatchers.set(i,s)),s.count+=1,j(()=>{s&&(s.count--,s.count===0&&(pt(s.disposable),this.activeWatchers.delete(i)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)pt(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,t,n,i){return this.writeQueue.queueFor(t,async()=>{let s=await e.open(t,{create:!0,unlock:n?.unlock??!1,append:n?.append??!1});try{kd(i)||xf(i)?await this.doWriteStreamBufferedQueued(e,s,i):await this.doWriteReadableBufferedQueued(e,s,i)}catch(a){throw to(a)}finally{await e.close(s)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,t,n){let i=0,s;if(xf(n)){if(n.buffer.length>0){let a=H.concat(n.buffer);await this.doWriteBuffer(e,t,a,a.byteLength,i,0),i+=a.byteLength}if(n.ended)return;s=n.stream}else s=n;return new Promise((a,l)=>{$a(s,{onData:async c=>{s.pause();try{await this.doWriteBuffer(e,t,c,c.byteLength,i,0)}catch(d){return l(d)}i+=c.byteLength,setTimeout(()=>s.resume())},onError:c=>l(c),onEnd:()=>a()})})}async doWriteReadableBufferedQueued(e,t,n){let i=0,s;for(;(s=n.read())!==null;)await this.doWriteBuffer(e,t,s,s.byteLength,i,0),i+=s.byteLength}async doWriteBuffer(e,t,n,i,s,a){let l=0;for(;l<i;){let c=await e.write(t,s+l,n.buffer,a+l,i-l);l+=c}}async doWriteUnbuffered(e,t,n,i){return this.writeQueue.queueFor(t,()=>this.doWriteUnbufferedQueued(e,t,n,i),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,t,n,i){let s;i instanceof H?s=i:kd(i)?s=await Ds(i):xf(i)?s=await ex(i):s=Y1(i),await e.writeFile(t,s.buffer,{create:!0,overwrite:!0,unlock:n?.unlock??!1,atomic:n?.atomic??!1,append:n?.append??!1})}async doPipeBuffered(e,t,n,i){return this.writeQueue.queueFor(i,()=>this.doPipeBufferedQueued(e,t,n,i),this.getExtUri(n).providerExtUri)}async doPipeBufferedQueued(e,t,n,i){let s,a;try{s=await e.open(t,{create:!1}),a=await n.open(i,{create:!0,unlock:!1});let l=H.alloc(this.BUFFER_SIZE),c=0,d=0,u=0;do u=await e.read(s,c,l.buffer,d,l.byteLength-d),await this.doWriteBuffer(n,a,l,u,c,d),c+=u,d+=u,d===l.byteLength&&(d=0);while(u>0)}catch(l){throw to(l)}finally{await wt.settled([typeof s=="number"?e.close(s):Promise.resolve(),typeof a=="number"?n.close(a):Promise.resolve()])}}async doPipeUnbuffered(e,t,n,i){return this.writeQueue.queueFor(i,()=>this.doPipeUnbufferedQueued(e,t,n,i),this.getExtUri(n).providerExtUri)}async doPipeUnbufferedQueued(e,t,n,i){return n.writeFile(i,await e.readFile(t),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,t,n,i){return this.writeQueue.queueFor(i,()=>this.doPipeUnbufferedToBufferedQueued(e,t,n,i),this.getExtUri(n).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,t,n,i){let s=await n.open(i,{create:!0,unlock:!1});try{let a=await e.readFile(t);await this.doWriteBuffer(n,s,H.wrap(a),a.byteLength,0,0)}catch(a){throw to(a)}finally{await n.close(s)}}async doPipeBufferedToUnbuffered(e,t,n,i){let s=await Ds(this.readFileBuffered(e,t,be.None));await this.doWriteUnbuffered(n,i,void 0,s)}throwIfFileSystemIsReadonly(e,t){if(e.capabilities&2048)throw new Jt(h(2077,null,this.resourceForError(t)),6);return e}throwIfFileIsReadonly(e,t){if((t.permissions??0)&1)throw new Jt(h(2077,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===N.file?e.fsPath:e.toString(!0)}};gs=T([g(0,O)],gs)});var pb,up,A_=w(()=>{pb=class{constructor(r,e){this.key=r;this.data=e;this.incoming=new Map;this.outgoing=new Map}},up=class{constructor(r){this._hashFn=r;this._nodes=new Map}roots(){let r=[];for(let e of this._nodes.values())e.outgoing.size===0&&r.push(e);return r}insertEdge(r,e){let t=this.lookupOrInsertNode(r),n=this.lookupOrInsertNode(e);t.outgoing.set(n.key,n),n.incoming.set(t.key,t)}removeNode(r){let e=this._hashFn(r);this._nodes.delete(e);for(let t of this._nodes.values())t.outgoing.delete(e),t.incoming.delete(e)}lookupOrInsertNode(r){let e=this._hashFn(r),t=this._nodes.get(e);return t||(t=new pb(e,r),this._nodes.set(e,t)),t}lookup(r){return this._nodes.get(this._hashFn(r))}isEmpty(){return this._nodes.size===0}toString(){let r=[];for(let[e,t]of this._nodes)r.push(`${e}
	(-> incoming)[${[...t.incoming.keys()].join(", ")}]
	(outgoing ->)[${[...t.outgoing.keys()].join(",")}]
`);return r.join(`
`)}findCycleSlow(){for(let[r,e]of this._nodes){let t=new Set([r]),n=this._findCycle(e,t);if(n)return n}}_findCycle(r,e){for(let[t,n]of r.outgoing){if(e.has(t))return[...e,t].join(" -> ");e.add(t);let i=this._findCycle(n,e);if(i)return i;e.delete(t)}}}});var SM,Ig,bg,pp,M_=w(()=>{he();Ve();K();Ou();A_();Z();mh();lv();SM=!1,Ig=class extends Error{constructor(r){super("cyclic dependency between services"),this.message=r.findCycleSlow()??`UNABLE to detect cycle, dumping graph: 
${r.toString()}`}},bg=class o{constructor(r=new rs,e=!1,t,n=SM){this._services=r;this._strict=e;this._parent=t;this._enableTracing=n;this._isDisposed=!1;this._servicesToMaybeDispose=new Set;this._children=new Set;this._activeInstantiations=new Set;this._services.set(Vt,this),this._globalGraph=n?t?._globalGraph??new up(i=>i):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,pt(this._children),this._children.clear();for(let r of this._servicesToMaybeDispose)Gp(r)&&r.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(r,e){this._throwIfDisposed();let t=this,n=new class extends o{dispose(){t._children.delete(n),super.dispose()}}(r,this._strict,this,this._enableTracing);return this._children.add(n),e?.add(n),n}invokeFunction(r,...e){this._throwIfDisposed();let t=pp.traceInvocation(this._enableTracing,r),n=!1;try{return r({get:s=>{if(n)throw Vp("service accessor is only valid during the invocation of its target method");let a=this._getOrCreateServiceInstance(s,t);return a||this._throwIfStrict(`[invokeFunction] unknown service '${s}'`,!1),a}},...e)}finally{n=!0,t.stop()}}createInstance(r,...e){this._throwIfDisposed();let t,n;return r instanceof ae?(t=pp.traceCreation(this._enableTracing,r.ctor),n=this._createInstance(r.ctor,r.staticArguments.concat(e),t)):(t=pp.traceCreation(this._enableTracing,r),n=this._createInstance(r,e,t)),t.stop(),n}_createInstance(r,e=[],t){let n=Gn.getServiceDependencies(r).sort((a,l)=>a.index-l.index),i=[];for(let a of n){let l=this._getOrCreateServiceInstance(a.id,t);l||this._throwIfStrict(`[createInstance] ${r.name} depends on UNKNOWN service ${a.id}.`,!1),i.push(l)}let s=n.length>0?n[0].index:e.length;if(e.length!==s){console.trace(`[createInstance] First service dependency of ${r.name} at position ${s+1} conflicts with ${e.length} static arguments`);let a=s-e.length;a>0?e=e.concat(new Array(a)):e=e.slice(0,s)}return Reflect.construct(r,e.concat(i))}_setCreatedServiceInstance(r,e){if(this._services.get(r)instanceof ae)this._services.set(r,e);else if(this._parent)this._parent._setCreatedServiceInstance(r,e);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(r){let e=this._services.get(r);return!e&&this._parent?this._parent._getServiceInstanceOrDescriptor(r):e}_getOrCreateServiceInstance(r,e){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(r));let t=this._getServiceInstanceOrDescriptor(r);return t instanceof ae?this._safeCreateAndCacheServiceInstance(r,t,e.branch(r,!0)):(e.branch(r,!1),t)}_safeCreateAndCacheServiceInstance(r,e,t){if(this._activeInstantiations.has(r))throw new Error(`illegal state - RECURSIVELY instantiating service '${r}'`);this._activeInstantiations.add(r);try{return this._createAndCacheServiceInstance(r,e,t)}finally{this._activeInstantiations.delete(r)}}_createAndCacheServiceInstance(r,e,t){let n=new up(l=>l.id.toString()),i=0,s=[{id:r,desc:e,_trace:t}],a=new Set;for(;s.length;){let l=s.pop();if(!a.has(String(l.id))){if(a.add(String(l.id)),n.lookupOrInsertNode(l),i++>1e3)throw new Ig(n);for(let c of Gn.getServiceDependencies(l.desc.ctor)){let d=this._getServiceInstanceOrDescriptor(c.id);if(d||this._throwIfStrict(`[createInstance] ${r} depends on ${c.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(c.id)),d instanceof ae){let u={id:c.id,desc:d,_trace:l._trace.branch(c.id,!0)};n.insertEdge(l,u),s.push(u)}}}}for(;;){let l=n.roots();if(l.length===0){if(!n.isEmpty())throw new Ig(n);break}for(let{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof ae){let u=this._createServiceInstanceWithOwner(c.id,c.desc.ctor,c.desc.staticArguments,c.desc.supportsDelayedInstantiation,c._trace);this._setCreatedServiceInstance(c.id,u)}n.removeNode(c)}}return this._getServiceInstanceOrDescriptor(r)}_createServiceInstanceWithOwner(r,e,t=[],n,i){if(this._services.get(r)instanceof ae)return this._createServiceInstance(r,e,t,n,i,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(r,e,t,n,i);throw new Error(`illegalState - creating UNKNOWN service instance ${e.name}`)}_createServiceInstance(r,e,t=[],n,i,s){if(n){let a=new o(void 0,this._strict,this,this._enableTracing);a._globalGraphImplicitDependency=String(r);let l=new Map,c=new lf(()=>{let d=a._createInstance(e,t,i);for(let[u,f]of l){let m=d[u];if(typeof m=="function")for(let y of f)y.disposable=m.apply(d,y.listener)}return l.clear(),s.add(d),d});return new Proxy(Object.create(null),{get(d,u){if(!c.isInitialized&&typeof u=="string"&&(u.startsWith("onDid")||u.startsWith("onWill"))){let y=l.get(u);return y||(y=new Ra,l.set(u,y)),(S,I,k)=>{if(c.isInitialized)return c.value[u](S,I,k);{let R={listener:[S,I,k],disposable:void 0},D=y.push(R);return j(()=>{D(),R.disposable?.dispose()})}}}if(u in d)return d[u];let f=c.value,m=f[u];return typeof m!="function"||(m=m.bind(f),d[u]=m),m},set(d,u,f){return c.value[u]=f,!0},getPrototypeOf(d){return e.prototype}})}else{let a=this._createInstance(e,t,i);return s.add(a),a}}_throwIfStrict(r,e){if(e&&console.warn(r),this._strict)throw new Error(r)}},pp=class o{constructor(r,e){this.type=r;this.name=e;this._start=Date.now();this._dep=[]}static{this.all=new Set}static{this._None=new class extends o{constructor(){super(0,null)}stop(){}branch(){return this}}}static traceInvocation(r,e){return r?new o(2,e.name||new Error().stack.split(`
`).slice(3,4).join(`
`)):o._None}static traceCreation(r,e){return r?new o(1,e.name):o._None}static{this._totals=0}branch(r,e){let t=new o(3,r.toString());return this._dep.push([r,e,t]),t}stop(){let r=Date.now()-this._start;o._totals+=r;let e=!1;function t(i,s){let a=[],l=new Array(i+1).join("	");for(let[c,d,u]of s._dep)if(d&&u){e=!0,a.push(`${l}CREATES -> ${c}`);let f=t(i+1,u);f&&a.push(f)}else a.push(`${l}uses -> ${c}`);return a.join(`
`)}let n=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${t(1,this)}`,`DONE, took ${r.toFixed(2)}ms (grand total ${o._totals.toFixed(2)}ms)`];(r>2||e)&&o.all.add(n.join(`
`))}}});var Sg,O_=w(()=>{K();re();Sg=class extends Us{constructor(e=ru){super();this.buffer=[];this._logger=void 0;this._logLevelDisposable=this._register(new er);this.setLevel(e)}set logger(e){this._logger=e,this.setLevel(e.getLevel()),this._logLevelDisposable.value=e.onDidChangeLogLevel(this.setLevel,this);for(let{level:t,message:n}of this.buffer)nu(e,t,n);this.buffer=[]}log(e,t){this._logger?nu(this._logger,e,t):this.getLevel()<=e&&this.buffer.push({level:e,message:t})}dispose(){this._logger?.dispose(),super.dispose()}flush(){this._logger?.flush()}}});import{session as xM}from"electron";var Bc,F_=w(()=>{K();ze();Se();Y();Ns();se();Mt();Qn();qr();re();Yn();Bc=class extends C{constructor(e,t,n){super();this.environmentService=e;this.logService=n;this.validRoots=zr.forPaths(!ne);this.validExtensions=new Set([".svg",".png",".jpg",".jpeg",".gif",".bmp",".webp",".mp4",".otf",".ttf"]);this.addValidFileRoot(e.appRoot),this.addValidFileRoot(e.extensionsPath),this.addValidFileRoot(t.defaultProfile.globalStorageHome.with({scheme:N.file}).fsPath),this.addValidFileRoot(e.workspaceStorageHome.with({scheme:N.file}).fsPath),this.handleProtocols()}handleProtocols(){let{defaultSession:e}=xM;e.protocol.registerFileProtocol(N.vscodeFileResource,(t,n)=>this.handleResourceRequest(t,n)),e.protocol.interceptFileProtocol(N.file,(t,n)=>this.handleFileRequest(t,n)),this._register(j(()=>{e.protocol.unregisterProtocol(N.vscodeFileResource),e.protocol.uninterceptProtocol(N.file)}))}addValidFileRoot(e){let t=kt(e);return this.validRoots.get(t)?C.None:(this.validRoots.set(t,!0),j(()=>this.validRoots.delete(t)))}handleFileRequest(e,t){let n=b.parse(e.url);return this.logService.error(`Refused to load resource ${n.fsPath} from ${N.file}: protocol (original URL: ${e.url})`),t({error:-3})}handleResourceRequest(e,t){let n=this.requestToNormalizedFilePath(e),i=ye(n),s;return this.environmentService.crossOriginIsolated&&(i==="workbench.html"||i==="workbench-dev.html"?s=Ma.CoopAndCoep:s=Ma.getHeadersFromQuery(e.url)),this.environmentService.isBuilt||(s={...s,...r1}),(i==="workbench.html"||i==="workbench-dev.html")&&(s={...s,...n1}),this.validRoots.findSubstr(n)?t({path:n,headers:s}):this.validExtensions.has(ba(n).toLowerCase())?t({path:n,headers:s}):(this.logService.error(`${N.vscodeFileResource}: Refused to load resource ${n} from ${N.vscodeFileResource}: protocol (original URL: ${e.url})`),t({error:-3}))}requestToNormalizedFilePath(e){let t=b.parse(e.url),n=et.uriToFileUri(t);return kt(n.fsPath)}createIPCObjectUrl(){let e,t=b.from({scheme:"vscode",path:xe()}),n=t.toString(),i=async()=>e;return ct.handle(n,i),this.logService.trace(`IPC Object URL: Registered new channel ${n}.`),{resource:t,update:s=>e=s,dispose:()=>{this.logService.trace(`IPC Object URL: Removed channel ${n}.`),ct.removeHandler(n)}}}};Bc=T([g(0,fr),g(1,_r),g(2,O)],Bc)});function N_(o){return!!o.forwardPort}function PM(o){if(o.scheme!=="http"&&o.scheme!=="https")return;let r=/^(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)$/.exec(o.authority);if(r)return{address:r[1],port:+r[2]}}function xg(o){return fb.indexOf(o)>=0}function Hc(o){return mb.indexOf(o)>=0}function B_(o,r,e,t){if(e===1)return!1;if(e===2&&Hc(r)){let n=/(\d+)\.(\d+)\.(\d+)/g.exec(t);if(n?.length===4&&parseInt(n[1])>=18)return!1}return o<1024}var U_,aEe,fb,mb,Vc,hb=w(()=>{Q();K();Y();se();st();Z();re();U_=W("tunnelService"),aEe=W("sharedTunnelsService");fb=["localhost","127.0.0.1","0:0:0:0:0:0:0:1","::1"];mb=["0.0.0.0","0:0:0:0:0:0:0:0","::"];Vc=class extends C{constructor(e,t){super();this.logService=e;this.configurationService=t;this._onTunnelOpened=this._register(new x);this.onTunnelOpened=this._onTunnelOpened.event;this._onTunnelClosed=this._register(new x);this.onTunnelClosed=this._onTunnelClosed.event;this._onAddedTunnelProvider=this._register(new x);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 n of t){let i=Array.from(n.values());for(let s of i){let a=await s.value;a&&typeof a!="string"&&e.push(a)}}return e}async dispose(){super.dispose();for(let e of this._tunnels.values()){for(let{value:t}of e.values())await t.then(n=>typeof n!="string"?n?.dispose():void 0);e.clear()}this._tunnels.clear()}setEnvironmentTunnel(e,t,n,i,s){this.addTunnelToMap(e,t,Promise.resolve({tunnelRemoteHost:e,tunnelRemotePort:t,localAddress:n,privacy:i,protocol:s,dispose:()=>Promise.resolve()}))}async getExistingTunnel(e,t){(Hc(e)||xg(e))&&(e=fb[0]);let n=this.getTunnelFromMap(e,t);if(n)return++n.refcount,n.value}openTunnel(e,t,n,i,s,a=!1,l,c){this.logService.trace(`ForwardedPorts: (TunnelService) openTunnel request for ${t}:${n} on local port ${s}.`);let d=this._tunnelProvider??e;if(!d)return;if(t||(t="localhost"),i||(i=this.defaultTunnelHost),this._tunnelProvider&&this._factoryInProgress.has(n)){this.logService.debug("ForwardedPorts: (TunnelService) Another call to create a tunnel with the same address has occurred before the last one completed. This call will be ignored.");return}let u=this.retainOrCreateTunnel(d,t,n,i,s,a,l,c);return u?u.then(f=>{if(f){if(typeof f=="string")return this.logService.trace("ForwardedPorts: (TunnelService) The tunnel provider returned an error when creating the tunnel."),this.removeEmptyOrErrorTunnelFromMap(t,n),f}else{this.logService.trace("ForwardedPorts: (TunnelService) New tunnel is undefined."),this.removeEmptyOrErrorTunnelFromMap(t,n);return}this.logService.trace("ForwardedPorts: (TunnelService) New tunnel established.");let m=this.makeTunnel(f);return(f.tunnelRemoteHost!==t||f.tunnelRemotePort!==n)&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Host or port mismatch."),l&&f.privacy!==l&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Privacy mismatch."),this._onTunnelOpened.fire(m),m}):(this.logService.trace("ForwardedPorts: (TunnelService) Tunnel was not created."),u)}makeTunnel(e){return{tunnelRemotePort:e.tunnelRemotePort,tunnelRemoteHost:e.tunnelRemoteHost,tunnelLocalPort:e.tunnelLocalPort,localAddress:e.localAddress,privacy:e.privacy,protocol:e.protocol,dispose:async()=>{this.logService.trace(`ForwardedPorts: (TunnelService) dispose request for ${e.tunnelRemoteHost}:${e.tunnelRemotePort} `);let t=this._tunnels.get(e.tunnelRemoteHost);if(t){let n=t.get(e.tunnelRemotePort);n&&(n.refcount--,await this.tryDisposeTunnel(e.tunnelRemoteHost,e.tunnelRemotePort,n))}}}}async tryDisposeTunnel(e,t,n){if(n.refcount<=0){this.logService.trace(`ForwardedPorts: (TunnelService) Tunnel is being disposed ${e}:${t}.`);let i=n.value.then(async s=>{s&&typeof s!="string"&&(await s.dispose(!0),this._onTunnelClosed.fire({host:s.tunnelRemoteHost,port:s.tunnelRemotePort}))});return this._tunnels.has(e)&&this._tunnels.get(e).delete(t),i}}async closeTunnel(e,t){this.logService.trace(`ForwardedPorts: (TunnelService) close request for ${e}:${t} `);let n=this._tunnels.get(e);if(n&&n.has(t)){let i=n.get(t);i.refcount=0,await this.tryDisposeTunnel(e,t,i)}}addTunnelToMap(e,t,n){this._tunnels.has(e)||this._tunnels.set(e,new Map),this._tunnels.get(e).set(t,{refcount:1,value:n})}async removeEmptyOrErrorTunnelFromMap(e,t){let n=this._tunnels.get(e);if(n){let i=n.get(t),s=i?await i.value:void 0;(!s||typeof s=="string")&&n.delete(t),n.size===0&&this._tunnels.delete(e)}}getTunnelFromMap(e,t){let n=[e];xg(e)?(n.push(...fb),n.push(...mb)):Hc(e)&&n.push(...mb);let i=n.map(s=>this._tunnels.get(s));for(let s of i){let a=s?.get(t);if(a)return a}}canTunnel(e){return!!PM(e)}createWithProvider(e,t,n,i,s,a,l){this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel with provider ${t}:${n} on local port ${i}.`);let c=n;this._factoryInProgress.add(c);let d=i===void 0?n:i,u={elevationRequired:s?this.isPortPrivileged(d):!1},f={remoteAddress:{host:t,port:n},localAddressPort:i,privacy:a,public:a?a!=="private":void 0,protocol:l},m=e.forwardPort(f,u);return m?(this.addTunnelToMap(t,n,m),m.finally(()=>{this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created by provider."),this._factoryInProgress.delete(c)})):this._factoryInProgress.delete(c),m}};Vc=T([g(0,O),g(1,ge)],Vc)});var pEe,Kc,V_=w(()=>{Ve();Z();pEe=W("remoteAuthorityResolverService"),Kc=class o extends on{static isNotAvailable(r){return r instanceof o&&r._code==="NotAvailable"}static isTemporarilyNotAvailable(r){return r instanceof o&&r._code==="TemporarilyNotAvailable"}static isNoResolverFound(r){return r instanceof o&&r._code==="NoResolverFound"}static isInvalidAuthority(r){return r instanceof o&&r._code==="InvalidAuthority"}static isHandled(r){return r instanceof o&&r.isHandled}constructor(r,e="Unknown",t){super(r),this._message=r,this._code=e,this._detail=t,this.isHandled=e==="NotAvailable"&&t===!0,Object.setPrototypeOf(this,o.prototype)}}});function vb(o){switch(o){case 1:return"Management";case 2:return"ExtensionHost";case 3:return"Tunnel"}}function K_(o){let r=new qe;return setTimeout(()=>r.cancel(),o),r.token}function TM(o,r){if(o.isCancellationRequested||r.isCancellationRequested)return be.Cancelled;let e=new qe;return o.onCancellationRequested(()=>e.cancel()),r.onCancellationRequested(()=>e.cancel()),e.token}function CM(o,r){let e=new mp(r);return e.registerDisposable(o.onControlMessage(t=>{let n=JSON.parse(t.toString()),i=WM(n);i?e.reject(i):e.resolve(n)})),e.promise}function _M(o,r,e,t,n,i,s,a){let l=new mp(a),c=sn.create(!1);return o.info(`Creating a socket (${s})...`),Ne(`code/willCreateSocket/${i}`),r.connect(e,t,n,s).then(d=>{l.didTimeout?(Ne(`code/didCreateSocketError/${i}`),o.info(`Creating a socket (${s}) finished after ${c.elapsed()} ms, but this is too late and has timed out already.`),d?.dispose()):(Ne(`code/didCreateSocketOK/${i}`),o.info(`Creating a socket (${s}) was successful after ${c.elapsed()} ms.`),l.resolve(d))},d=>{Ne(`code/didCreateSocketError/${i}`),o.info(`Creating a socket (${s}) returned an error after ${c.elapsed()} ms.`),o.error(d),l.reject(d)}),l.promise}function gb(o,r){let e=new mp(r);return o.then(t=>{e.didTimeout||e.resolve(t)},t=>{e.didTimeout||e.reject(t)}),e.promise}async function kM(o,r,e,t){let n=G_(o,r);o.logService.trace(`${n} 1/6. invoking socketFactory.connect().`);let i;try{i=await _M(o.logService,o.remoteSocketFactoryService,o.connectTo,Cv.getServerRootPath(),`reconnectionToken=${o.reconnectionToken}&reconnection=${o.reconnectionProtocol?"true":"false"}`,vb(r),`renderer-${vb(r)}-${o.reconnectionToken}`,t)}catch(d){throw o.logService.error(`${n} socketFactory.connect() failed or timed out. Error:`),o.logService.error(d),d}o.logService.trace(`${n} 2/6. socketFactory.connect() was successful.`);let s,a;o.reconnectionProtocol?(o.reconnectionProtocol.beginAcceptReconnection(i,null),s=o.reconnectionProtocol,a=!1):(s=new _f({socket:i}),a=!0),o.logService.trace(`${n} 3/6. sending AuthRequest control message.`);let l=await gb(o.signService.createNewMessage(xe()),t),c={type:"auth",auth:o.connectionToken||"00000000000000000000",data:l.data};s.sendControl(H.fromString(JSON.stringify(c)));try{let d=await CM(s,TM(t,K_(1e4)));if(d.type!=="sign"||typeof d.data!="string"){let y=new Error("Unexpected handshake message");throw y.code="VSCODE_CONNECTION_ERROR",y}if(o.logService.trace(`${n} 4/6. received SignRequest control message.`),!await gb(o.signService.validate(l,d.signedData),t)){let y=new Error("Refused to connect to unsupported server");throw y.code="VSCODE_CONNECTION_ERROR",y}let f=await gb(o.signService.sign(d.data),t),m={type:"connectionType",commit:o.commit,signedData:f,desiredConnectionType:r};return e&&(m.args=e),o.logService.trace(`${n} 5/6. sending ConnectionTypeRequest control message.`),s.sendControl(H.fromString(JSON.stringify(m))),{protocol:s,ownsProtocol:a}}catch(d){throw d&&d.code==="ETIMEDOUT"&&(o.logService.error(`${n} the handshake timed out. Error:`),o.logService.error(d)),d&&d.code==="VSCODE_CONNECTION_ERROR"&&(o.logService.error(`${n} received error control message when negotiating connection. Error:`),o.logService.error(d)),a&&z_(s),d}}async function RM(o,r,e){let t=Date.now(),n=G_(o,3),{protocol:i}=await kM(o,3,r,e);return o.logService.trace(`${n} 6/6. handshake finished, connection is up and running after ${OM(t)}!`),i}async function $_(o,r,e){let{connectTo:t,connectionToken:n}=await o.addressProvider.getAddress();return{commit:o.commit,quality:o.quality,connectTo:t,connectionToken:n,reconnectionToken:r,reconnectionProtocol:e,remoteSocketFactoryService:o.remoteSocketFactoryService,signService:o.signService,logService:o.logService}}async function q_(o,r,e){let t=await $_(o,xe(),null);return await RM(t,{host:r,port:e},be.None)}function DM(o){return zn(r=>new Promise((e,t)=>{let n=setTimeout(e,o*1e3);r.onCancellationRequested(()=>{clearTimeout(n),e()})}))}function z_(o){try{o.acceptDisconnect();let r=o.getSocket();o.dispose(),r.dispose()}catch(r){rt(r)}}function WM(o){if(o&&o.type==="error"){let r=new Error(`Connection error: ${o.reason}`);return r.code="VSCODE_CONNECTION_ERROR",r}return null}function LM(o,r){return typeof o!="number"||!isFinite(o)||o<0?r:o>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:Math.floor(o)}function AM(o,r){for(;o.length<r;)o+=" ";return o}function MM(o,r){return`[remote-connection][${AM(vb(o),13)}][${r.substr(0,5)}\u2026]`}function fp(o,r,e){return`${MM(o,r)}[${e?"reconnect":"initial"}]`}function G_(o,r){return`${fp(r,o.reconnectionToken,!!o.reconnectionProtocol)}[${o.connectTo}]`}function OM(o){return`${Date.now()-o} ms`}var EM,mp,yb,wb,Ib,Pg,bb,H_,j_=w(()=>{he();nt();St();Ve();Q();K();ze();ai();xs();Mt();Qv();V_();EM=30*1e3;mp=class{get didTimeout(){return this._state==="timedout"}constructor(r){this._state="pending",this._disposables=new te,{promise:this.promise,resolve:this._resolvePromise,reject:this._rejectPromise}=p1(),r.isCancellationRequested?this._timeout():this._disposables.add(r.onCancellationRequested(()=>this._timeout()))}registerDisposable(r){this._state==="pending"?this._disposables.add(r):r.dispose()}_timeout(){this._state==="pending"&&(this._disposables.dispose(),this._state="timedout",this._rejectPromise(this._createTimeoutError()))}_createTimeoutError(){let r=new Error("Time limit reached");return r.code="ETIMEDOUT",r.syscall="connect",r}resolve(r){this._state==="pending"&&(this._disposables.dispose(),this._state="resolved",this._resolvePromise(r))}reject(r){this._state==="pending"&&(this._disposables.dispose(),this._state="rejected",this._rejectPromise(r))}};yb=class{constructor(r,e){this.reconnectionToken=r;this.millisSinceLastIncomingData=e;this.type=0}},wb=class{constructor(r,e,t,n){this.reconnectionToken=r;this.millisSinceLastIncomingData=e;this.durationSeconds=t;this.cancellableTimer=n;this.type=1}skipWait(){this.cancellableTimer.cancel()}},Ib=class{constructor(r,e,t){this.reconnectionToken=r;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=2}},Pg=class{constructor(r,e,t){this.reconnectionToken=r;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=4}},bb=class{constructor(r,e,t,n){this.reconnectionToken=r;this.millisSinceLastIncomingData=e;this.attempt=t;this.handled=n;this.type=3}},H_=class o extends C{constructor(e,t,n,i,s){super();this._connectionType=e;this._options=t;this.reconnectionToken=n;this.protocol=i;this._reconnectionFailureIsFatal=s;this._onDidStateChange=this._register(new x);this.onDidStateChange=this._onDidStateChange.event;this._permanentFailure=!1;this._isReconnecting=!1;this._isDisposed=!1;this._reconnectionGraceTime=108e5;this._onDidStateChange.fire(new Pg(this.reconnectionToken,0,0)),this._register(i.onSocketClose(a=>{let l=fp(this._connectionType,this.reconnectionToken,!0);a?a.type===0?(this._options.logService.info(`${l} received socket close event (hadError: ${a.hadError}).`),a.error&&this._options.logService.error(a.error)):(this._options.logService.info(`${l} received socket close event (wasClean: ${a.wasClean}, code: ${a.code}, reason: ${a.reason}).`),a.event&&this._options.logService.error(a.event)):this._options.logService.info(`${l} received socket close event.`),this._beginReconnecting()})),this._register(i.onSocketTimeout(a=>{let l=fp(this._connectionType,this.reconnectionToken,!0);this._options.logService.info(`${l} received socket timeout event (unacknowledgedMsgCount: ${a.unacknowledgedMsgCount}, timeSinceOldestUnacknowledgedMsg: ${a.timeSinceOldestUnacknowledgedMsg}, timeSinceLastReceivedSomeData: ${a.timeSinceLastReceivedSomeData}).`),this._beginReconnecting()})),o._instances.push(this),this._register(j(()=>{let a=o._instances.indexOf(this);a>=0&&o._instances.splice(a,1)})),this._isPermanentFailure&&this._gotoPermanentFailure(o._permanentFailureMillisSinceLastIncomingData,o._permanentFailureAttempt,o._permanentFailureHandled)}static triggerPermanentFailure(e,t,n){this._permanentFailure=!0,this._permanentFailureMillisSinceLastIncomingData=e,this._permanentFailureAttempt=t,this._permanentFailureHandled=n,this._instances.forEach(i=>i._gotoPermanentFailure(this._permanentFailureMillisSinceLastIncomingData,this._permanentFailureAttempt,this._permanentFailureHandled))}static debugTriggerReconnection(){this._instances.forEach(e=>e._beginReconnecting())}static debugPauseSocketWriting(){this._instances.forEach(e=>e._pauseSocketWriting())}static{this._permanentFailure=!1}static{this._permanentFailureMillisSinceLastIncomingData=0}static{this._permanentFailureAttempt=0}static{this._permanentFailureHandled=!1}static{this._instances=[]}get _isPermanentFailure(){return this._permanentFailure||o._permanentFailure}updateGraceTime(e){let t=LM(e,108e5),n=fp(this._connectionType,this.reconnectionToken,!1);this._options.logService.trace(`${n} 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=fp(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 yb(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData()));let t=[0,5,5,10,10,10,10,10,30],n=this._reconnectionGraceTime;if(this._options.logService.info(`${e} starting reconnection with grace time: ${n}ms (${Math.floor(n/1e3)}s)`),n<=0){this._options.logService.error(`${e} reconnection grace time is set to 0ms, will not attempt to reconnect.`),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),0,!1);return}let i=Date.now(),s=-1;do{s++;let a=s<t.length?t[s]:t[t.length-1];try{if(a>0){let c=DM(a);this._onDidStateChange.fire(new wb(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),a,c)),this._options.logService.info(`${e} waiting for ${a} 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 Ib(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s+1)),this._options.logService.info(`${e} resolving connection...`);let l=await $_(this._options,this.reconnectionToken,this.protocol);this._options.logService.info(`${e} connecting to ${l.connectTo}...`),await this._reconnect(l,K_(EM)),this._options.logService.info(`${e} reconnected!`),this._onDidStateChange.fire(new Pg(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s+1));break}catch(l){if(l.code==="VSCODE_CONNECTION_ERROR"){this._options.logService.error(`${e} A permanent error occurred in the reconnecting loop! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}if(Date.now()-i>=n){let c=Math.round(n/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(),s+1,!1);break}if(Kc.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(id(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 Kc){this._options.logService.error(`${e} A RemoteAuthorityResolverError occurred while trying to reconnect. Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,Kc.isHandled(l));break}this._options.logService.error(`${e} An unknown error occurred while trying to reconnect, since this is an unknown case, it will be treated as a permanent error! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),s+1,!1);break}}while(!this._isPermanentFailure&&!this._isDisposed)}_onReconnectionPermanentFailure(e,t,n){this._reconnectionFailureIsFatal?o.triggerPermanentFailure(e,t,n):this._gotoPermanentFailure(e,t,n)}_gotoPermanentFailure(e,t,n){this._onDidStateChange.fire(new bb(this.reconnectionToken,e,t,n)),z_(this.protocol)}_pauseSocketWriting(){this.protocol.pauseSocketWriting()}}});var Eg,J_=w(()=>{K();Z();Eg=W("remoteSocketFactoryService")});import*as Q_ from"net";import*as X_ from"os";async function FM(o,r,e,t,n){let i;for(let s=3;s&&(i?.dispose(),i=await new Sb(o,r,e,t,n).waitForReady(),!(n&&Jw[n]||!Jw[i.tunnelLocalPort]));s--);return i}var Sb,hp,ma,Tg,Y_=w(()=>{Xw();Za();he();K();Y();st();re();Qt();j_();J_();Rh();hb();nt();Sb=class extends C{constructor(e,t,n,i,s){super();this.defaultTunnelHost=t;this.suggestedLocalPort=s;this.privacy="private";this._socketsDispose=new Map;this._options=e,this._server=Q_.createServer(),this._barrier=new mi,this._listeningListener=()=>this._barrier.open(),this._server.on("listening",this._listeningListener),this._connectionListener=a=>this._onConnection(a),this._server.on("connection",this._connectionListener),this._errorListener=()=>{},this._server.on("error",this._errorListener),this.tunnelRemotePort=i,this.tunnelRemoteHost=n}async dispose(){super.dispose(),this._server.removeListener("listening",this._listeningListener),this._server.removeListener("connection",this._connectionListener),this._server.removeListener("error",this._errorListener),this._server.close(),Array.from(this._socketsDispose.values()).forEach(t=>{t()})}async waitForReady(){let e=this.suggestedLocalPort??this.tunnelRemotePort,t=Hc(this.defaultTunnelHost)?"0.0.0.0":"127.0.0.1",n=await Qw(e,2,1e3,t),i=null;return this._server.listen(n,this.defaultTunnelHost),await this._barrier.wait(),i=this._server.address(),i||(n=0,this._server.listen(n,this.defaultTunnelHost),await this._barrier.wait(),i=this._server.address()),this.tunnelLocalPort=i.port,this.localAddress=`${this.tunnelRemoteHost==="127.0.0.1"?"127.0.0.1":"localhost"}:${i.port}`,this}async _onConnection(e){e.pause();let t=xg(this.tunnelRemoteHost)||Hc(this.tunnelRemoteHost)?"localhost":this.tunnelRemoteHost,n=await q_(this._options,t,this.tunnelRemotePort),i=n.getSocket(),s=n.readEntireBuffer();n.dispose(),s.byteLength>0&&e.write(s.buffer),e.on("end",()=>{e.localAddress&&this._socketsDispose.delete(e.localAddress),i.end()}),e.on("close",()=>i.end()),e.on("error",()=>{e.localAddress&&this._socketsDispose.delete(e.localAddress),i instanceof Qi?i.socket.destroy():i.end()}),i instanceof Qi?this._mirrorNodeSocket(e,i):this._mirrorGenericSocket(e,i),e.localAddress&&this._socketsDispose.set(e.localAddress,()=>{e.end(),i.end()})}_mirrorGenericSocket(e,t){t.onClose(()=>e.destroy()),t.onEnd(()=>e.end()),t.onData(n=>e.write(n.buffer)),e.on("data",n=>t.write(H.wrap(n))),e.resume()}_mirrorNodeSocket(e,t){let n=t.socket;n.on("end",()=>e.end()),n.on("close",()=>e.end()),n.on("error",()=>{e.destroy()}),n.pipe(e),e.pipe(n)}},hp=class extends Vc{constructor(e,t,n,i,s){super(t,s);this.remoteSocketFactoryService=e;this.signService=n;this.productService=i}isPortPrivileged(e){return B_(e,this.defaultTunnelHost,Lt,X_.release())}retainOrCreateTunnel(e,t,n,i,s,a,l,c){let d=this.getTunnelFromMap(t,n);if(d)return++d.refcount,d.value;if(N_(e))return this.createWithProvider(e,t,n,s,a,l,c);{this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel without provider ${t}:${n} on local port ${s}.`);let u={commit:this.productService.commit,quality:this.productService.quality,addressProvider:e,remoteSocketFactoryService:this.remoteSocketFactoryService,signService:this.signService,logService:this.logService,ipcLogger:null},f=FM(u,i,t,n,s);return this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created without provider."),this.addTunnelToMap(t,n,f),f}}};hp=T([g(0,Eg),g(1,O),g(2,ds),g(3,_e),g(4,ge)],hp);ma=class extends hp{constructor(r,e,t,n,i){super(r,e,t,n,i)}};ma=T([g(0,Eg),g(1,O),g(2,ds),g(3,_e),g(4,ge)],ma);Tg=class extends C{constructor(e,t,n,i,s){super();this.remoteSocketFactoryService=e;this.logService=t;this.productService=n;this.signService=i;this.configurationService=s;this._tunnelServices=new Map}async openTunnel(e,t,n,i,s,a,l,c,d){if(this.logService.trace(`ForwardedPorts: (SharedTunnelService) openTunnel request for ${n}:${i} on local port ${a}.`),!this._tunnelServices.has(e)){let u=new ma(this.remoteSocketFactoryService,this.logService,this.signService,this.productService,this.configurationService);this._register(u),this._tunnelServices.set(e,u),u.onTunnelClosed(async()=>{(await u.tunnels).length===0&&(u.dispose(),this._tunnelServices.delete(e))})}return this._tunnelServices.get(e).openTunnel(t,n,i,s,a,l,c,d)}};Tg=T([g(0,Eg),g(1,O),g(2,_e),g(3,ds),g(4,ge)],Tg)});import{parse as Z_}from"url";function UM(o,r){return o.protocol==="http:"?r.HTTP_PROXY||r.http_proxy||null:o.protocol==="https:"&&(r.HTTPS_PROXY||r.https_proxy||r.HTTP_PROXY||r.http_proxy)||null}async function ek(o,r,e={}){let t=Z_(o),n=e.proxyUrl||UM(t,r);if(!n)return null;let i=Z_(n);if(!/^https?:$/.test(i.protocol||""))return null;let s={host:i.hostname||"",port:(i.port?+i.port:0)||(i.protocol==="https"?443:80),auth:i.auth,rejectUnauthorized:qp(e.strictSSL)?e.strictSSL:!0};if(t.protocol==="http:"){let{default:a}=await import("http-proxy-agent");return new a.HttpProxyAgent(n,s)}else{let{default:a}=await import("https-proxy-agent");return new a.HttpsProxyAgent(n,s)}}var tk=w(()=>{We()});import{parse as rk}from"url";import{createGunzip as NM}from"zlib";function HM(o){if(o instanceof Error){let r=o.code;return!!r&&BM.has(r)}return!1}async function KM(o,r,e,t){let n=await import("kerberos"),i=n.default||n,s=new URL(o),a=r||(process.platform==="win32"?`HTTP/${s.hostname}`:`HTTP@${s.hostname}`);return e.debug(`${t} Kerberos authentication lookup`,`proxyURL:${s}`,`spn:${a}`),(await i.initializeClient(a)).step("")}async function $M(o){return(rk(o.url).protocol==="https:"?await import("https"):await import("http")).request}async function nk(o,r){let t,n=VM.test(o.type||"GET");for(let i=1;i<=3;i++)try{return await qM(o,r)}catch(s){if(t=s,s instanceof Et||!n||!HM(s)||i===3)throw s;await lt(100*i,r)}throw t}async function qM(o,r){return wt.withAsyncBody(async(e,t)=>{let n=rk(o.url),i=o.getRawRequest?o.getRawRequest(o):await $M(o),s={hostname:n.hostname,port:n.port?parseInt(n.port):n.protocol==="https:"?443:80,protocol:n.protocol,path:n.path,method:o.type||"GET",headers:o.headers,agent:o.agent,rejectUnauthorized:qp(o.strictSSL)?o.strictSSL:!0};o.user&&o.password&&(s.auth=o.user+":"+o.password),o.disableCache&&(s.cache="no-store");let a=i(s,c=>{let d=Hn(o.followRedirects)?o.followRedirects:3;if(c.statusCode&&c.statusCode>=300&&c.statusCode<400&&d>0&&c.headers.location)nk({...o,url:c.headers.location,followRedirects:d-1},r).then(e,t);else{let u=c;!o.isChromiumNetwork&&c.headers["content-encoding"]==="gzip"&&(u=c.pipe(NM())),e({res:c,stream:tx(u)})}});if(a.on("error",t),o.timeout)if(o.isChromiumNetwork){let c=setTimeout(()=>{a.abort(),t(new Error(`Request timeout after ${o.timeout}ms`))},o.timeout);a.on("response",()=>clearTimeout(c)),a.on("error",()=>clearTimeout(c)),a.on("abort",()=>clearTimeout(c))}else a.setTimeout(o.timeout);o.isChromiumNetwork&&a.removeHeader("Content-Length"),o.data&&typeof o.data=="string"&&a.write(o.data),a.end();let l=r.onCancellationRequested(()=>{l.dispose(),a.abort(),t(new Et)});a.on("response",()=>l.dispose()),a.on("error",()=>l.dispose())})}var BM,VM,$c,ik=w(()=>{he();nt();Ve();We();st();qr();zm();re();ns();tk();BM=new Set(["EAI_AGAIN","ECONNREFUSED","EHOSTDOWN","EHOSTUNREACH","ENETDOWN","ENETUNREACH","EPROTO"]),VM=/^(GET|HEAD|OPTIONS)$/i;$c=class extends yh{constructor(e,t,n,i){super(i);this.machine=e;this.configurationService=t;this.environmentService=n;this.configure(),this._register(t.onDidChangeConfiguration(s=>{s.affectsConfiguration("http")&&this.configure()}))}configure(){this.proxyUrl=this.getConfigValue("http.proxy"),this.strictSSL=!!this.getConfigValue("http.proxyStrictSSL"),this.authorization=this.getConfigValue("http.proxyAuthorization")}async request(e,t){let{proxyUrl:n,strictSSL:i}=this,s;try{s=await Nl(this.configurationService,this.logService,this.environmentService.args,process.env)}catch(c){this.shellEnvErrorLogged||(this.shellEnvErrorLogged=!0,this.logService.error("resolving shell environment failed",qt(c)))}let a={...process.env,...s},l=e.agent?e.agent:await ek(e.url||"",a,{proxyUrl:n,strictSSL:i});return e.agent=l,e.strictSSL=i,this.authorization&&(e.headers={...e.headers||{},"Proxy-Authorization":this.authorization}),this.logAndRequest(e,()=>nk(e,t))}async resolveProxy(e){}async lookupAuthorization(e){}async lookupKerberosAuthorization(e){try{let t=this.getConfigValue("http.proxyKerberosServicePrincipal");return"Negotiate "+await KM(e,t,this.logService,"RequestService#lookupKerberosAuthorization")}catch(t){this.logService.debug("RequestService#lookupKerberosAuthorization Kerberos authentication failed",t);return}}async loadCertificates(){return(await import("@vscode/proxy-agent")).loadSystemCertificates({loadSystemCertificatesFromNode:()=>this.getConfigValue("http.systemCertificatesNode",rI),log:this.logService})}getConfigValue(e,t){if(this.machine==="remote")return this.configurationService.getValue(e);let n=this.configurationService.inspect(e);return n.userLocalValue??n.defaultValue??t}};$c=T([g(1,ge),g(2,fr),g(3,O)],$c)});import{net as zM}from"electron";function GM(o){return zM.request}var qc,ok=w(()=>{ik();st();qr();re();qc=class extends $c{constructor(r,e,t){super("local",r,e,t)}request(r,e){return super.request({...r||{},getRawRequest:GM,isChromiumNetwork:!0},e)}};qc=T([g(0,ge),g(1,fr),g(2,O)],qc)});function Cg(o,r,e){r instanceof ae||(r=new ae(r,[],!!e)),jM.push([o,r])}var jM,xb=w(()=>{Ou();jM=[]});import{app as sk,webContents as QM}from"electron";import{cpus as ak}from"os";var gp,lk=w(()=>{Qh();xb();gp=class{buildWebContentsLookup(){let r=new Map,e=new Map;for(let t of QM.getAllWebContents()){let n=t,i=typeof n.getOSProcessId=="function"?n.getOSProcessId():0,s=typeof n.getProcessId=="function"?n.getProcessId():0;i&&r.set(i,t),s&&e.set(s,t)}return{wcByPid:r,wcByInternalId:e}}async resolveMemoryMB(r,e,t){let n=r.memory,i=n?.privateBytes??n?.workingSetSize??0;if(i>0)return i/1024;let s=e.get(r.pid)??t.get(r.id??0);if(s){let a=s;if(typeof a.getProcessMemoryInfo=="function")try{let l=await a.getProcessMemoryInfo(),c=l?.private??l?.residentSet??0;if(c>0)return c/1024}catch{}}return-1}async getRendererProcessInfo(){try{let r=sk.getAppMetrics().filter(n=>n.type==="Tab"),{wcByPid:e,wcByInternalId:t}=this.buildWebContentsLookup();return await Promise.all(r.map(async n=>{let i=n.cpu?.percentCPUUsage*ak().length||0,s=await this.resolveMemoryMB(n,e,t);return{pid:n.pid,cpuPercent:i,memoryMB:s}}))}catch(r){return console.error("Failed to get renderer process stats:",r),[]}}async getAllProcessInfo(){try{let r=sk.getAppMetrics(),{wcByPid:e,wcByInternalId:t}=this.buildWebContentsLookup();return await Promise.all(r.map(async n=>{let i=n.cpu?.percentCPUUsage*ak().length||0,s=await this.resolveMemoryMB(n,e,t);return{pid:n.pid,cpuPercent:i,memoryMB:s,type:n.type||"Unknown"}}))}catch(r){return console.error("Failed to get all process stats:",r),[]}}};Cg(gc,gp,1)});var _g,ck=w(()=>{_g=class o{constructor(){this.validators=new Map}static{this._nextId=1}async createNewMessage(r){try{let e=await this.getValidator();if(e){let t=String(o._nextId++);return this.validators.set(t,e),{id:t,data:e.createNewMessage(r)}}}catch{}return{id:"",data:r}}async validate(r,e){if(!r.id)return!0;let t=this.validators.get(r.id);if(!t)return!1;this.validators.delete(r.id);try{return t.validate(e)==="ok"}catch{return!1}finally{t.dispose?.()}}async sign(r){try{return await this.signValue(r)}catch{}return r}}});var kg,dk=w(()=>{ck();kg=class extends _g{getValidator(){return this.vsda().then(r=>new r.validator)}signValue(r){return this.vsda().then(e=>new e.signer().sign(r))}async vsda(){let r="vsda",{default:e}=await import(r);return e}}});var ha,uk=w(()=>{ri();he();K();re();ha=class extends sa{constructor(e,t){super();this.logService=e;this.productName=t;this.throttler=this._register(new hd);this.watcher=this._register(new er)}async _updatePolicyDefinitions(e){this.logService.trace(`NativePolicyService#_updatePolicyDefinitions - Found ${Object.keys(e).length} policy definitions`);let{createWatcher:t}=await import("@vscode/policy-watcher");await this.throttler.queue(()=>new Promise((n,i)=>{try{this.watcher.value=t(this.productName,e,s=>{this._onDidPolicyChange(s),n()})}catch(s){this.logService.error("NativePolicyService#_updatePolicyDefinitions - Error creating watcher:",s),i(s)}}))}_onDidPolicyChange(e){this.logService.trace(`NativePolicyService#_onDidPolicyChange - Updated policy values: ${JSON.stringify(e)}`);for(let t in e){let n=e[t];n===void 0?this.policies.delete(t):this.policies.set(t,n)}this._onDidChange.fire(Object.keys(e))}};ha=T([g(0,O)],ha)});function XM(o,r){let e=[];for(let t of new Set(pi.concat(o.keys(),r.keys())))o.get(t)!==r.get(t)&&e.push(t);return e}var ga,pk=w(()=>{he();Q();sd();We();je();re();ri();ga=class extends sa{constructor(e,t,n){super();this.file=e;this.fileService=t;this.logService=n;this.throttledDelayer=this._register(new Pr(500));let i=E.filter(t.onDidFilesChange,s=>s.affects(e));this._register(t.watch(e)),this._register(i(()=>this.throttledDelayer.trigger(()=>this.refresh())))}async _updatePolicyDefinitions(){await this.refresh()}async read(){let e=new Map;try{let t=await this.fileService.readFile(this.file),n=JSON.parse(t.value.toString());if(!Je(n))throw new Error("Policy file isn't a JSON object");for(let i of Object.keys(n))this.policyDefinitions[i]&&e.set(i,n[i])}catch(t){t.fileOperationResult!==1&&this.logService.error("[FilePolicyService] Failed to read policies",t)}return e}async refresh(){let e=await this.read(),t=XM(this.policies,e);this.policies=e,t.length>0&&this._onDidChange.fire(t)}};ga=T([g(1,ke),g(2,O)],ga)});var Rg,va,fk=w(()=>{Xn();se();xb();je();yt();Q();K();zt();Rg=class o{constructor(r){this.uri=r;this.time=o._clock++}static{this._clock=0}touch(){return this.time=o._clock++,this}},va=class{constructor(r){this._fileService=r;this._dispooables=new te;this._limit=2**16;let e=new Map,t=n=>{let i=e.get(n.scheme);return i===void 0&&(i=r.hasProvider(n)&&!this._fileService.hasCapability(n,1024),e.set(n.scheme,i)),i};this._dispooables.add(E.any(r.onDidChangeFileSystemProviderRegistrations,r.onDidChangeFileSystemProviderCapabilities)(n=>{if(e.get(n.scheme)===void 0)return;e.delete(n.scheme);let s=t(b.from({scheme:n.scheme}));if(s!==s)for(let[a,l]of this._canonicalUris.entries())l.uri.scheme===n.scheme&&this._canonicalUris.delete(a)})),this.extUri=new Cs(t),this._canonicalUris=new Map}dispose(){this._dispooables.dispose(),this._canonicalUris.clear()}asCanonicalUri(r){this._fileService.hasProvider(r)&&(r=rf(r));let e=this.extUri.getComparisonKey(r,!0),t=this._canonicalUris.get(e);return t?t.touch().uri.with({fragment:r.fragment}):(this._canonicalUris.set(e,new Rg(r)),this._checkTrim(),r)}_checkTrim(){if(this._canonicalUris.size<this._limit)return;Rg._clock=1;let r=[...this._canonicalUris.values()].map(t=>t.time),e=Hp(Math.floor(r.length/2),r,(t,n)=>t-n);for(let[t,n]of this._canonicalUris.entries())n.time<=e?this._canonicalUris.delete(t):n.time=0}};va=T([g(0,ke)],va);Cg(Dt,va,1)});var Dg,mk=w(()=>{K();re();Dg=class extends C{constructor(r,e=[]){super(),this.logger=new Gf([r,...e]),this._register(r.onDidChangeLogLevel(t=>this.setLevel(t)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(r){this.logger.setLevel(r)}getLevel(){return this.logger.getLevel()}trace(r,...e){this.logger.trace(r,...e)}debug(r,...e){this.logger.debug(r,...e)}info(r,...e){this.logger.info(r,...e)}warn(r,...e){this.logger.warn(r,...e)}error(r,...e){this.logger.error(r,...e)}flush(){this.logger.flush()}}});var Wg,hk=w(()=>{Q();K();je();Ns();Lr();Wg=class extends C{constructor(e,t,n,i,s,a){super();this.fileSystemScheme=e;this.fileSystemProvider=t;this.userDataScheme=n;this.userDataProfilesService=i;this.uriIdentityService=s;this.logService=a;this.capabilities=this.fileSystemProvider.capabilities,this.onDidChangeCapabilities=this.fileSystemProvider.onDidChangeCapabilities,this._onDidChangeFile=this._register(new x),this.onDidChangeFile=this._onDidChangeFile.event,this.watchResources=zr.forUris(()=>!(this.capabilities&1024)),this.atomicReadWriteResources=new Ea(l=>this.uriIdentityService.extUri.getComparisonKey(this.toFileSystemResource(l))),this.updateAtomicReadWritesResources(),this._register(i.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,n,i,s){return this.fileSystemProvider.read(e,t,n,i,s)}write(e,t,n,i,s){return this.fileSystemProvider.write(e,t,n,i,s)}watch(e,t){this.watchResources.set(e,e);let n=this.fileSystemProvider.watch(this.toFileSystemResource(e),t);return j(()=>{this.watchResources.delete(e),n.dispose()})}stat(e){return this.fileSystemProvider.stat(this.toFileSystemResource(e))}mkdir(e){return this.fileSystemProvider.mkdir(this.toFileSystemResource(e))}rename(e,t,n){return this.fileSystemProvider.rename(this.toFileSystemResource(e),this.toFileSystemResource(t),n)}readFile(e,t){return this.fileSystemProvider.readFile(this.toFileSystemResource(e),t)}readFileStream(e,t,n){return this.fileSystemProvider.readFileStream(this.toFileSystemResource(e),t,n)}readdir(e){return this.fileSystemProvider.readdir(this.toFileSystemResource(e))}enforceAtomicReadFile(e){return this.atomicReadWriteResources.has(e)}writeFile(e,t,n){return this.fileSystemProvider.writeFile(this.toFileSystemResource(e),t,n)}enforceAtomicWriteFile(e){return this.atomicReadWriteResources.has(e)?{postfix:".vsctmp"}:!1}delete(e,t){return this.fileSystemProvider.delete(this.toFileSystemResource(e),t)}copy(e,t,n){if(iu(this.fileSystemProvider))return this.fileSystemProvider.copy(this.toFileSystemResource(e),this.toFileSystemResource(t),n);throw new Error("copy not supported")}cloneFile(e,t){if(Xf(this.fileSystemProvider))return this.fileSystemProvider.cloneFile(this.toFileSystemResource(e),this.toFileSystemResource(t));throw new Error("clone not supported")}handleFileChanges(e){let t=[];for(let n of e){if(n.resource.scheme!==this.fileSystemScheme)continue;let i=this.toUserDataResource(n.resource);this.watchResources.findSubstr(i)&&t.push({resource:i,type:n.type,cId:n.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 gk=w(()=>{});import Fr from"electron";var YM,ZM,eO,tO,vk,yk,wk,Ik,Xr,Yr,bk=w(()=>{Q();K();Y();st();Jr();gk();zt();Wt();re();YM="#FFFFFF",ZM="#1F1F1F",eO="#000000",tO="#FFFFFF",vk="theme",yk="themeBackground",wk="windowSplash",Ik="windowSplashWorkspaceOverride",Xr=class{constructor(r,e){this.key=r;this.defaultValue=e}getValue(r){return r.getValue(this.key)??this.defaultValue}};(i=>(i.DETECT_COLOR_SCHEME=new i("window.autoDetectColorScheme",!1),i.DETECT_HC=new i("window.autoDetectHighContrast",!0),i.SYSTEM_COLOR_THEME=new i("window.systemColorTheme","default"),i.AUXILIARYBAR_DEFAULT_VISIBILITY=new i("workbench.secondarySideBar.defaultVisibility","visibleInWorkspace"),i.STARTUP_EDITOR=new i("workbench.startupEditor","welcomePage")))(Xr||={});Yr=class extends C{constructor(e,t,n){super();this.stateService=e;this.configurationService=t;this.logService=n;this._onDidChangeColorScheme=this._register(new x);this.onDidChangeColorScheme=this._onDidChangeColorScheme.event;ne||this._register(this.configurationService.onDidChangeConfiguration(i=>{(i.affectsConfiguration(Xr.SYSTEM_COLOR_THEME.key)||i.affectsConfiguration(Xr.DETECT_COLOR_SCHEME.key))&&(this.updateSystemColorTheme(),this.logThemeSettings())})),this.updateSystemColorTheme(),this.logThemeSettings(),this._register(E.fromNodeEventEmitter(Fr.nativeTheme,"updated")(()=>{this.logThemeSettings(),this._onDidChangeColorScheme.fire(this.getColorScheme())}))}static{this.DEFAULT_BAR_WIDTH=300}static{this.WORKSPACE_OVERRIDE_LIMIT=50}logThemeSettings(){if(this.logService.getLevel()>=2){let e=n=>`${n.key}=${n.getValue(this.configurationService)}`;this.logService.debug(`[theme main service] ${e(Xr.DETECT_COLOR_SCHEME)}, ${e(Xr.DETECT_HC)}, ${e(Xr.SYSTEM_COLOR_THEME)}`);let t=n=>`${String(n)}=${Fr.nativeTheme[n]}`;this.logService.debug(`[theme main service] electron.nativeTheme: ${t("themeSource")}, ${t("shouldUseDarkColors")}, ${t("shouldUseHighContrastColors")}, ${t("shouldUseInvertedColorScheme")}, ${t("shouldUseDarkColorsForSystemIntegratedUI")}	`),this.logService.debug(`[theme main service] New color scheme: ${JSON.stringify(this.getColorScheme())}`)}}updateSystemColorTheme(){if(ne||Xr.DETECT_COLOR_SCHEME.getValue(this.configurationService))Fr.nativeTheme.themeSource="system";else switch(Xr.SYSTEM_COLOR_THEME.getValue(this.configurationService)){case"dark":Fr.nativeTheme.themeSource="dark";break;case"light":Fr.nativeTheme.themeSource="light";break;case"auto":switch(this.getPreferredBaseTheme()??this.getStoredBaseTheme()){case"vs":Fr.nativeTheme.themeSource="light";break;case"vs-dark":Fr.nativeTheme.themeSource="dark";break;default:Fr.nativeTheme.themeSource="system"}break;default:Fr.nativeTheme.themeSource="system";break}}getColorScheme(){if(M){if(Fr.nativeTheme.shouldUseHighContrastColors)return{dark:Fr.nativeTheme.shouldUseInvertedColorScheme,highContrast:!0}}else if(V){if(Fr.nativeTheme.shouldUseInvertedColorScheme||Fr.nativeTheme.shouldUseHighContrastColors)return{dark:Fr.nativeTheme.shouldUseDarkColors,highContrast:!0}}else if(ne&&Fr.nativeTheme.shouldUseHighContrastColors)return{dark:!0,highContrast:!0};return{dark:Fr.nativeTheme.shouldUseDarkColors,highContrast:!1}}getPreferredBaseTheme(){let e=this.getColorScheme();if(Xr.DETECT_HC.getValue(this.configurationService)&&e.highContrast)return e.dark?"hc-black":"hc-light";if(Xr.DETECT_COLOR_SCHEME.getValue(this.configurationService))return e.dark?"vs-dark":"vs"}getBackgroundColor(){let e=this.getPreferredBaseTheme(),t=this.getStoredBaseTheme();if(e===void 0||e===t){let n=this.stateService.getItem(yk,null);if(n)return n}switch(e??t){case"vs":return YM;case"hc-black":return eO;case"hc-light":return tO;default:return ZM}}getStoredBaseTheme(){switch(this.stateService.getItem(vk,"vs-dark").split(" ")[0]){case"vs":return"vs";case"hc-black":return"hc-black";case"hc-light":return"hc-light";default:return"vs-dark"}}saveWindowSplash(e,t,n){let i=this.updateWindowSplashOverride(t,n);this.stateService.setItems(at([{key:vk,data:n.baseTheme},{key:yk,data:n.colorInfo.background},{key:wk,data:n},i?{key:Ik,data:i}:void 0])),typeof e=="number"&&this.updateBackgroundColor(e,n),this.updateSystemColorTheme()}updateWindowSplashOverride(e,t){let n,i=!1;return e&&(n={...this.getWindowSplashOverride()},i=this.doUpdateWindowSplashOverride(e,t,n,"sideBar"),i=this.doUpdateWindowSplashOverride(e,t,n,"auxiliaryBar")||i),i?n:void 0}doUpdateWindowSplashOverride(e,t,n,i){let s=i==="sideBar"?t.layoutInfo?.sideBarWidth:t.layoutInfo?.auxiliaryBarWidth,a=i==="sideBar"?n.layoutInfo.sideBarWidth:n.layoutInfo.auxiliaryBarWidth,l=!1;if(typeof s!="number")return n.layoutInfo.workspaces[e.id]&&(delete n.layoutInfo.workspaces[e.id],l=!0),l;let c=n.layoutInfo.workspaces[e.id];if(!c){let d=Object.keys(n.layoutInfo.workspaces);d.length>=Yr.WORKSPACE_OVERRIDE_LIMIT&&(delete n.layoutInfo.workspaces[d[0]],l=!0),c={sideBarVisible:!1,auxiliaryBarVisible:!1},n.layoutInfo.workspaces[e.id]=c,l=!0}if(s>0)switch(a!==s&&(n.layoutInfo[i==="sideBar"?"sideBarWidth":"auxiliaryBarWidth"]=s,l=!0),i){case"sideBar":c.sideBarVisible||(c.sideBarVisible=!0,l=!0);break;case"auxiliaryBar":c.auxiliaryBarVisible||(c.auxiliaryBarVisible=!0,l=!0);break}else switch(i){case"sideBar":c.sideBarVisible&&(c.sideBarVisible=!1,l=!0);break;case"auxiliaryBar":c.auxiliaryBarVisible&&(c.auxiliaryBarVisible=!1,l=!0);break}return l}updateBackgroundColor(e,t){for(let n of Ei())if(n.id===e){n.setBackgroundColor(t.colorInfo.background);break}}getWindowSplash(e){try{return this.doGetWindowSplash(e)}catch(t){this.logService.error("[theme main service] Failed to get window splash",t);return}}doGetWindowSplash(e){let t=this.stateService.getItem(wk);if(!t?.layoutInfo)return t;let n=this.getWindowSplashOverride(),i;e?n.layoutInfo.workspaces[e.id]?.sideBarVisible===!1?i=0:i=n.layoutInfo.sideBarWidth||t.layoutInfo.sideBarWidth||Yr.DEFAULT_BAR_WIDTH:i=0;let s=Xr.AUXILIARYBAR_DEFAULT_VISIBILITY.getValue(this.configurationService),a=Xr.STARTUP_EDITOR.getValue(this.configurationService),l;if(e){let c=n.layoutInfo.workspaces[e.id]?.auxiliaryBarVisible;c===!0?l=n.layoutInfo.auxiliaryBarWidth||t.layoutInfo.auxiliaryBarWidth||Yr.DEFAULT_BAR_WIDTH:c===!1?l=0:a!=="agentSessionsWelcomePage"&&(s==="visible"||s==="visibleInWorkspace")?l=n.layoutInfo.auxiliaryBarWidth||t.layoutInfo.auxiliaryBarWidth||Yr.DEFAULT_BAR_WIDTH:a!=="agentSessionsWelcomePage"&&(s==="maximized"||s==="maximizedInWorkspace")?l=Number.MAX_SAFE_INTEGER:l=0}else l=0;return{...t,layoutInfo:{...t.layoutInfo,sideBarWidth:i,auxiliaryBarWidth:l}}}getWindowSplashOverride(){let e=this.stateService.getItem(Ik);return e?.layoutInfo||(e={layoutInfo:{sideBarWidth:Yr.DEFAULT_BAR_WIDTH,auxiliaryBarWidth:Yr.DEFAULT_BAR_WIDTH,workspaces:{}}}),e.layoutInfo.sideBarWidth||(e.layoutInfo.sideBarWidth=Yr.DEFAULT_BAR_WIDTH),e.layoutInfo.auxiliaryBarWidth||(e.layoutInfo.auxiliaryBarWidth=Yr.DEFAULT_BAR_WIDTH),e.layoutInfo.workspaces||(e.layoutInfo.workspaces={}),e}};Yr=T([g(0,ft),g(1,ge),g(2,O)],Yr)});var sO={};import{app as rO,dialog as nO}from"electron";import{unlinkSync as iO,promises as Sk}from"fs";var Pb,oO,xk=w(()=>{V1();se();zt();he();Ro();Ve();an();Q();Ji();ze();Se();ai();Y();Bn();dr();jt();vi();Za();P_();Ce();st();C_();R_();Ot();Ol();W_();je();L_();dh();Ou();M_();mh();xt();O_();re();Pd();Qt();Nh();F_();hb();Y_();ns();ok();Qh();lk();Rh();dk();Jr();cs();pl();qo();ri();uk();pk();K();Xn();fk();Xl();mk();qy();Ly();hk();Va();bk();Sd();Pb=class{main(){try{this.startup()}catch(r){console.error(r.message),rO.exit(1)}}async startup(){Bp(c=>console.error(c));let[r,e,t,n,i,s,a,l]=this.createServices();try{try{await this.initServices(t,l,n,i,a)}catch(c){throw this.handleStartupDataDirError(t,a,c),c}await r.invokeFunction(async c=>{let d=c.get(O),u=c.get(me),f=c.get(ke),m=c.get(Fo),y=await this.claimInstance(d,t,u,r,a,!0);if(q.writeFile(t.mainLockfile,String(process.pid)).catch(S=>{d.warn(`app#startup(): Error writing main lockfile: ${S.stack}`)}),s.logger=m.createLogger("main",{name:h(167,null)}),E.once(u.onWillShutdown)(S=>{f.dispose(),n.dispose(),S.join("instanceLockfile",Sk.unlink(t.mainLockfile).catch(()=>{}))}),await this.checkInnoSetupMutex(a)){let S=`${a.nameShort} is currently being updated. Please wait for the update to complete before launching.`;r.invokeFunction(this.quit,new Error(S));return}return r.createInstance(ms,y,e).startup()})}catch(c){r.invokeFunction(this.quit,c)}}createServices(){let r=new rs,e=new te;process.once("exit",()=>e.dispose());let t={_serviceBrand:void 0,...Er};r.set(_e,t);let n=new gn(this.resolveArgs(),t),i=this.patchEnvironment(n);r.set(Te,n);let s=new Th(Vx(n),n.logsHome);r.set(Wi,s);let a=new Sg(s.getLogLevel()),l=e.add(new Dg(a,[new zf(s.getLogLevel())]));r.set(O,l);let c=new gs(l);r.set(ke,c);let d=new ts(l);c.registerProvider(N.file,d);let u=new va(c);r.set(Dt,u);let f=new vl(1,n,l,c);r.set(am,f),r.set(ft,f);let m=new yl(f,u,n,c,l);r.set(Or,m),c.registerProvider(N.vscodeUserData,new Wg(N.file,d,N.vscodeUserData,m,u,l));let y;M&&t.win32RegValueName?y=e.add(new ha(l,t.win32RegValueName)):V&&t.darwinBundleIdentifier?y=e.add(new ha(l,t.darwinBundleIdentifier)):ne?y=e.add(new ga(b.file(_1),c,l)):n.policyFile?y=e.add(new ga(n.policyFile,c,l)):y=new Ql,r.set(An,y);let v=new wg(m.defaultProfile.settingsResource,c,y,l);return r.set(ge,v),r.set(me,new ae(Ti,void 0,!1)),r.set(Ln,new ae(qc,void 0,!0)),r.set(Pi,new ae(Yr)),r.set(ds,new ae(kg,void 0,!1)),r.set(U_,new ae(ma)),r.set(gc,new ae(gp,void 0,!0)),r.set(oc,new Bc(n,m,l)),[new bg(r,!0),i,n,v,f,a,t,m]}patchEnvironment(r){let e={VSCODE_IPC_HOOK:r.mainIPCHandle};return["VSCODE_NLS_CONFIG","VSCODE_PORTABLE"].forEach(t=>{let n=process.env[t];typeof n=="string"&&(e[t]=n)}),Object.assign(process.env,e),e}async initServices(r,e,t,n,i){await wt.settled([Promise.all([this.allowWindowsUNCPath(r.extensionsPath),r.codeCachePath,r.logsHome.with({scheme:N.file}).fsPath,e.defaultProfile.globalStorageHome.with({scheme:N.file}).fsPath,r.workspaceStorageHome.with({scheme:N.file}).fsPath,r.localHistoryHome.with({scheme:N.file}).fsPath,r.backupHome].map(s=>s?Sk.mkdir(s,{recursive:!0}):void 0)),n.init(),t.initialize()]),e.init()}allowWindowsUNCPath(r){if(M){let e=pf(r);e&&zi(e)}return r}async claimInstance(r,e,t,n,i,s){let a;try{Ne("code/willStartMainServer"),a=await fx(e.mainIPCHandle),Ne("code/didStartMainServer"),E.once(t.onWillShutdown)(()=>a.dispose())}catch(l){if(l.code!=="EADDRINUSE")throw this.handleStartupDataDirError(e,i,l),l;let c;try{c=await mx(e.mainIPCHandle,"main")}catch(m){if(!s||M||m.code!=="ECONNREFUSED")throw m.code==="EPERM"&&this.showStartupWarningDialog(h(168,null,i.nameShort),h(169,null),i),m;try{iO(e.mainIPCHandle)}catch(y){throw r.warn("Could not delete obsolete instance handle",y),y}return this.claimInstance(r,e,t,n,i,!1)}if(e.extensionTestsLocationURI&&!e.debugExtensionHost.break){let m=`Running extension tests from the command line is currently only supported if no other instance of ${i.nameShort} is running.`;throw r.error(m),c.dispose(),new Error(m)}let d;!e.args.wait&&!e.args.status&&(d=setTimeout(()=>{this.showStartupWarningDialog(h(170,null,i.nameShort),h(171,null),i)},1e4));let u=He.toService(c.getChannel("launch"),{disableMarshalling:!0}),f=He.toService(c.getChannel("diagnostics"),{disableMarshalling:!0});if(e.args.status)return n.invokeFunction(async()=>{let m=new Nc(ls,i),y=await f.getMainDiagnostics(),v=await f.getRemoteDiagnostics({includeProcesses:!0,includeWorkspaceMetadata:!0}),S=await m.getDiagnostics(y,v);throw console.log(S),new Sa});throw M&&await this.windowsAllowSetForegroundWindow(u,r),r.trace("Sending env to running instance..."),await u.start(e.args,process.env),c.dispose(),d&&clearTimeout(d),new Sa("Sent env to running instance. Terminating...")}if(e.args.status)throw console.log(h(174,null,i.nameShort)),new Sa("Terminating...");return process.env.VSCODE_PID=String(process.pid),a}handleStartupDataDirError(r,e,t){if(t.code==="EACCES"||t.code==="EPERM"){let n=at([r.userDataPath,r.extensionsPath,kf]).map(i=>ji(b.file(i),{os:Lt,tildify:r}));this.showStartupWarningDialog(h(172,null),h(173,null,Tr(t),n.join(`
`)),e)}}showStartupWarningDialog(r,e,t){nO.showMessageBoxSync(Rm({type:"warning",buttons:[h(166,null)],message:r,detail:e},t).options)}async windowsAllowSetForegroundWindow(r,e){if(M){let t=await r.getMainProcessId();e.trace("Sending some foreground love to the running instance:",t);try{(await import("windows-foreground-love")).allowSetForegroundWindow(t)}catch(n){e.error(n)}}}quit(r,e){let t=r.get(O),n=r.get(me),i=0;e&&(e.isExpected?e.message&&t.trace(e.message):(i=1,e.stack?t.error(e.stack):t.error(`Startup error: ${e.toString()}`))),n.kill(i)}async checkInnoSetupMutex(r){if(!(M&&r.win32MutexName&&r.win32VersionedUpdate))return!1;try{let e=`${r.win32MutexName}-updating`;return(await import("@vscode/windows-mutex")).isActive(e)}catch(e){return console.error("Failed to check Inno Setup mutex:",e),!1}}resolveArgs(){let r=this.validatePaths(t0(process.argv));if(r.wait&&!r.waitMarkerFilePath){let e=D_(r.verbose);e&&(r0(process.argv,"--waitMarkerFilePath",e),r.waitMarkerFilePath=e)}return r}validatePaths(r){if(r["open-url"]&&(r._urls=r._,r._=[]),!r.remote){let e=this.doValidatePaths(r._,r.goto);r._=e}return r}doValidatePaths(r,e){let t=mn(),n=r.map(a=>{let l=String(a),c;e&&(c=La(l),l=c.path),l&&(l=this.preparePath(t,l));let d=Zp(l,t),u=ye(d);return u&&!JS(u)?null:e&&c?(c.path=d,this.toPath(c)):d}),i=M||V,s=Wr(n,a=>a&&i?a.toLowerCase():a||"");return at(s)}preparePath(r,e){return M&&(e=$n(e,'"')),e=hv(hv(e," "),"	"),M&&(e=It(r,e),e=$n(e,".")),e}toPath(r){let e=[r.path];return typeof r.line=="number"&&e.push(String(r.line)),typeof r.column=="number"&&e.push(String(r.column)),e.join(":")}},oO=new Pb;oO.main()});import*as Fn from"node:path";import*as Un from"original-fs";import*as Tk from"node:os";import{performance as aO}from"node:perf_hooks";import*as br from"node:path";import*as Ng from"node:fs";import{createRequire as Fk}from"node:module";var _O=Fk(import.meta.url),kO=process.platform==="win32";Error.stackTraceLimit=100;if(!process.env.VSCODE_HANDLES_SIGPIPE){let o=!1;process.on("SIGPIPE",()=>{o||(o=!0,console.error(new Error("Unexpected SIGPIPE")))})}function Uk(){try{typeof process.env.VSCODE_CWD!="string"&&(process.env.VSCODE_CWD=process.cwd()),process.platform==="win32"&&process.chdir(br.dirname(process.execPath))}catch(o){console.error(o)}}Uk();function Wb(o){let r=br.dirname(import.meta.dirname);function e(){return process.env.VSCODE_DEV?r:process.platform==="darwin"?br.dirname(br.dirname(br.dirname(r))):process.platform==="win32"&&o.win32VersionedUpdate?br.dirname(br.dirname(br.dirname(r))):br.dirname(br.dirname(r))}function t(){if(process.env.VSCODE_PORTABLE)return process.env.VSCODE_PORTABLE;if(process.platform==="win32"||process.platform==="linux")return br.join(e(),"data");let l=o.portable||`${o.applicationName}-portable-data`;return br.join(br.dirname(e()),l)}let n=t(),i=!("target"in o)&&Ng.existsSync(n),s=br.join(n,"tmp"),a=i&&Ng.existsSync(s);return i?process.env.VSCODE_PORTABLE=n:delete process.env.VSCODE_PORTABLE,a&&(process.platform==="win32"?(process.env.TMP=s,process.env.TEMP=s):process.env.TMPDIR=s),{portableDataPath:n,isPortable:i}}import*as xp from"node:fs";import{register as Hk}from"node:module";import{createRequire as Nk}from"node:module";var Yc=Nk(import.meta.url),ys={BUILD_INSERT_PRODUCT_CONFIGURATION:"BUILD_INSERT_PRODUCT_CONFIGURATION"};ys.BUILD_INSERT_PRODUCT_CONFIGURATION&&(ys=Yc("../product.json"));var Zc={"name":"Windsurf","version":"1.110.1","distro":"d89d49b77ba5f8bdfdfe3b039067e7da38e25640","author":{"name":"Exafunction, Inc."},"main":"./out/main.js","type":"module","private":true,"engines":{"node":"22.22.0"},"engineStrict":true,"scripts":{"test":"echo Please run any of the test scripts from the scripts folder.","test-browser":"npx playwright install && node test/unit/browser/index.js","test-browser-no-install":"node test/unit/browser/index.js","test-node":"mocha test/unit/node/index.js --delay --ui=tdd --timeout=30000 --exit","test-extension":"vscode-test","test-build-scripts":"cd build && npm run test","check-cyclic-dependencies":"node build/lib/checkCyclicDependencies.ts out","preinstall":"node build/npm/preinstall.ts","postinstall":"patch-package && node build/npm/postinstall.ts","prepare-exa":"cd .. && pnpm install --frozen-lockfile && pnpm build:windsurf-deps && cd windsurf && npm run generate-ls-version && npm run protoc && npm run copy-chat-client && npm run copy-windsurf-acp","copy-chat-client":"node ../exa/chat_client/scripts/copy-to-windsurf.js","copy-windsurf-acp":"node ../exa/windsurf_acp/scripts/copy-to-windsurf.js","port-protos":"node -e \"require('fs').cpSync('./extensions/windsurf/src/generated', 'src/vs/base/common/generated', {recursive: true})\"","protoc":"buf generate .. --path ../exa/language_server_pb/language_server.proto --path ../exa/product_analytics_pb/product_analytics.proto --path ../exa/cascade_plugins_pb/cascade_plugins.proto --path ../exa/seat_management_pb/seat_management.proto --path ../exa/extension_server_pb/extension_server.proto --path ../exa/browser_preview_pb/browser_preview.proto --path ../exa/codeium_common_pb/codeium_common.proto --path ../exa/chat_client_server_pb/chat_client_server.proto --path ../exa/dev_pb/dev.proto --include-imports --disable-symlinks","setup-dev":"npm install && npm run prepare-exa && bash build_windsurf/download_fd_and_devin_cli.sh","compile":"npm run gulp compile","compile-check-ts-native":"tsgo --project ./src/tsconfig.json --noEmit --skipLibCheck","watch":"npm-run-all2 -lp watch-client-transpile watch-client watch-extensions watch-theme-windsurf","watchd":"deemon npm run watch","watch-webd":"deemon npm run watch-web","kill-watchd":"deemon --kill npm run watch","kill-watch-webd":"deemon --kill npm run watch-web","restart-watchd":"deemon --restart npm run watch","restart-watch-webd":"deemon --restart npm run watch-web","watch-client":"npm run gulp watch-client","watch-clientd":"deemon npm run watch-client","kill-watch-clientd":"deemon --kill npm run watch-client","watch-client-transpile":"node build/next/index.ts transpile --watch","watch-client-transpiled":"deemon npm run watch-client-transpile","kill-watch-client-transpiled":"deemon --kill npm run watch-client-transpile","watch-extensions":"npm run gulp watch-extensions watch-extension-media","watch-theme-windsurf":"node ../exa/windsurf-ds-theme/build.js --watch","watch-extensionsd":"deemon npm run watch-extensions","kill-watch-extensionsd":"deemon --kill npm run watch-extensions","gulp":"node --max-old-space-size=8192 ./node_modules/gulp/bin/gulp.js","gulp-extra-memory":"node --max-old-space-size=16384 --optimize-for-size ./node_modules/gulp/bin/gulp.js","precommit":"node build/hygiene.ts","electron":"node build/lib/electron.ts","7z":"7z","update-grammars":"node build/npm/update-all-grammars.ts","update-localization-extension":"node build/npm/update-localization-extension.ts","mixin-telemetry-docs":"node build/npm/mixin-telemetry-docs.ts","smoketest":"node build/lib/preLaunch.ts && cd test/smoke && npm run compile && node test/index.js","smoketest-no-compile":"cd test/smoke && node test/index.js","download-builtin-extensions":"node build/lib/builtInExtensions.ts","download-builtin-extensions-cg":"node build/lib/builtInExtensionsCG.ts","monaco-compile-check":"tsgo --project src/tsconfig.monaco.json --noEmit","tsec-compile-check":"node node_modules/tsec/bin/tsec -p src/tsconfig.tsec.json","vscode-dts-compile-check":"tsgo --project src/tsconfig.vscode-dts.json && tsgo --project src/tsconfig.vscode-proposed-dts.json","valid-layers-check":"node build/checker/layersChecker.ts && tsgo --project build/checker/tsconfig.browser.json && tsgo --project build/checker/tsconfig.worker.json && tsgo --project build/checker/tsconfig.node.json && tsgo --project build/checker/tsconfig.electron-browser.json && tsgo --project build/checker/tsconfig.electron-main.json && tsgo --project build/checker/tsconfig.electron-utility.json","define-class-fields-check":"node build/lib/propertyInitOrderChecker.ts && tsgo --project src/tsconfig.defineClassFields.json","update-distro":"node build/npm/update-distro.ts","web":"echo 'npm run web' is replaced by './scripts/code-server' or './scripts/code-web'","compile-cli":"npm run gulp compile-cli","compile-web":"npm run gulp compile-web","watch-web":"npm run gulp watch-web","watch-cli":"npm run gulp watch-cli","eslint":"node build/eslint.ts","stylelint":"node build/stylelint.ts","playwright-install":"npm exec playwright install","compile-build":"npm run gulp compile-build-with-mangling","compile-extensions-build":"npm run gulp compile-extensions-build","minify-vscode":"npm run gulp minify-vscode","minify-vscode-reh":"npm run gulp minify-vscode-reh","minify-vscode-reh-web":"npm run gulp minify-vscode-reh-web","hygiene":"npm run gulp hygiene","format-file":"node scripts/format-file.js","core-ci":"npm run gulp core-ci","core-ci-pr":"npm run gulp core-ci-pr","extensions-ci":"npm run gulp extensions-ci","extensions-ci-pr":"npm run gulp extensions-ci-pr","perf":"node scripts/code-perf.js","update-build-ts-version":"npm install -D typescript@next && npm install -D @typescript/native-preview && (cd build && npm run typecheck)","install-local-component-explorer":"npm install ../vscode-packages/js-component-explorer/dist/vscode-component-explorer-0.1.0.tgz ../vscode-packages/js-component-explorer/dist/vscode-component-explorer-cli-0.1.0.tgz --no-save && cd build/vite && npm install ../../../vscode-packages/js-component-explorer/dist/vscode-component-explorer-vite-plugin-0.1.0.tgz --no-save","symlink-local-component-explorer":"npm install ../vscode-packages/js-component-explorer/packages/explorer ../vscode-packages/js-component-explorer/packages/cli --no-save && cd build/vite && npm install ../../../vscode-packages/js-component-explorer/packages/vite-plugin ../../../vscode-packages/js-component-explorer/packages/explorer --no-save","install-latest-component-explorer":"npm install @vscode/component-explorer@next @vscode/component-explorer-cli@next && cd build/vite && npm install @vscode/component-explorer-vite-plugin@next && npm install @vscode/component-explorer@next","generate-ls-version":"node scripts/generate_ls_version.js"},"dependencies":{"@anthropic-ai/sandbox-runtime":"0.0.23","@bufbuild/protobuf":"^1.10.0","@c4312/eventsource-umd":"^3.0.5","@connectrpc/connect":"^1.6.1","@connectrpc/connect-web":"^1.6.1","@microsoft/1ds-core-js":"^3.2.13","@microsoft/1ds-post-js":"^3.2.13","@parcel/watcher":"^2.5.6","@types/semver":"^7.5.8","@vscode/codicons":"Exafunction/vscode-codicons#cc51ce9","@vscode/deviceid":"^0.1.1","@vscode/iconv-lite-umd":"0.7.1","@vscode/native-watchdog":"^1.4.6","@vscode/policy-watcher":"Exafunction/vscode-policy-watcher#63a1f6f","@vscode/proxy-agent":"^0.38.0","@vscode/ripgrep":"^1.15.13","@vscode/spdlog":"^0.15.7","@vscode/sqlite3":"5.1.12-vscode","@vscode/sudo-prompt":"9.3.2","@vscode/tree-sitter-wasm":"^0.3.0","@vscode/vscode-languagedetection":"1.0.23","@vscode/windows-mutex":"^0.5.0","@vscode/windows-process-tree":"^0.6.0","@vscode/windows-registry":"^1.2.0","@xterm/addon-clipboard":"^0.3.0-beta.167","@xterm/addon-image":"^0.10.0-beta.167","@xterm/addon-ligatures":"^0.11.0-beta.167","@xterm/addon-progress":"^0.3.0-beta.167","@xterm/addon-search":"^0.17.0-beta.167","@xterm/addon-serialize":"^0.15.0-beta.167","@xterm/addon-unicode11":"^0.10.0-beta.167","@xterm/addon-webgl":"^0.20.0-beta.166","@xterm/headless":"^6.1.0-beta.167","@xterm/xterm":"^6.1.0-beta.167","http-proxy-agent":"^7.0.0","https-proxy-agent":"^7.0.2","jschardet":"3.1.4","jsonc-parser":"^3.3.1","katex":"^0.16.22","kerberos":"2.1.1","mermaid":"^11.12.1","minimist":"^1.2.8","motion":"^12.23.24","native-is-elevated":"0.9.0","native-keymap":"^3.3.5","node-pty":"^1.2.0-beta.10","open":"^10.1.2","playwright-core":"1.59.0-alpha-2026-02-20","preact":"^10.27.3","react":"^19.2.0","react-dom":"^19.2.0","svg-pan-zoom":"^3.6.2","tas-client":"0.3.1","undici":"^7.18.2","unleash-client":"^6.10.1","unleash-proxy-client":"^3.7.6","v8-inspect-profiler":"^0.1.1","vscode-oniguruma":"1.7.0","vscode-regexpp":"^3.1.0","vscode-textmate":"^9.3.2","yauzl":"^3.0.0","yazl":"^2.4.3","zustand":"^5.0.0"},"devDependencies":{"@babel/preset-env":"^7.21.4","@babel/preset-react":"^7.18.6","@babel/preset-typescript":"^7.21.4","@bufbuild/buf":"1.36.0","@bufbuild/protoc-gen-es":"1.9.0","@connectrpc/protoc-gen-connect-es":"1.4.0","@playwright/test":"^1.56.1","@stylistic/eslint-plugin-ts":"^2.8.0","@types/cookie":"^0.3.3","@types/debug":"^4.1.5","@types/diff":"^6.0.0","@types/eslint":"^9.6.1","@types/gulp-svgmin":"^1.2.1","@types/http-proxy-agent":"^2.0.1","@types/kerberos":"^1.1.2","@types/minimist":"^1.2.1","@types/mocha":"^10.0.10","@types/node":"^22.18.10","@types/sinon":"^10.0.2","@types/sinon-test":"^2.4.2","@types/trusted-types":"^2.0.7","@types/vscode-notebook-renderer":"^1.72.0","@types/webpack":"^5.28.5","@types/wicg-file-system-access":"^2023.10.7","@types/windows-foreground-love":"^0.3.0","@types/winreg":"^1.2.30","@types/yauzl":"^2.10.0","@types/yazl":"^2.4.2","@typescript-eslint/utils":"^8.45.0","@typescript/native-preview":"^7.0.0-dev.20260130","@vscode/component-explorer":"^0.1.1-16","@vscode/component-explorer-cli":"^0.1.1-12","@vscode/gulp-electron":"1.40.0","@vscode/l10n-dev":"0.0.35","@vscode/telemetry-extractor":"^1.10.2","@vscode/test-cli":"^0.0.6","@vscode/test-electron":"^2.4.0","@vscode/test-web":"^0.0.76","@vscode/v8-heap-parser":"^0.1.0","@vscode/vscode-perf":"^0.0.19","@webgpu/types":"^0.1.66","ansi-colors":"^3.2.3","asar":"^3.0.3","chromium-pickle-js":"^0.2.0","cookie":"^0.7.2","copy-webpack-plugin":"^11.0.0","css-loader":"^6.9.1","debounce":"^1.0.0","deemon":"^1.13.6","electron":"39.6.0","eslint":"^9.36.0","eslint-formatter-compact":"^8.40.0","eslint-plugin-header":"3.1.1","eslint-plugin-jsdoc":"^50.3.1","event-stream":"3.3.4","fancy-log":"^1.3.3","file-loader":"^6.2.0","glob":"^5.0.13","gulp":"^4.0.0","gulp-azure-storage":"^0.12.1","gulp-bom":"^3.0.0","gulp-buffer":"0.0.2","gulp-filter":"^5.1.0","gulp-flatmap":"^1.0.2","gulp-gunzip":"^1.0.0","gulp-gzip":"^1.4.2","gulp-json-editor":"^2.5.0","gulp-plumber":"^1.2.0","gulp-rename":"^1.2.0","gulp-replace":"^0.5.4","gulp-sourcemaps":"^3.0.0","gulp-svgmin":"^4.1.0","husky":"^0.13.1","innosetup":"^6.4.1","istanbul-lib-coverage":"^3.2.0","istanbul-lib-instrument":"^6.0.1","istanbul-lib-report":"^3.0.0","istanbul-lib-source-maps":"^4.0.1","istanbul-reports":"^3.1.5","lazy.js":"^0.4.2","merge-options":"^1.0.1","mime":"^1.4.1","minimatch":"^3.0.4","mocha":"^10.8.2","mocha-junit-reporter":"^2.2.1","mocha-multi-reporters":"^1.5.1","npm-run-all2":"^8.0.4","os-browserify":"^0.3.0","p-all":"^1.0.0","patch-package":"^8.0.0","path-browserify":"^1.0.1","postcss":"^8.4.33","postcss-nesting":"^12.0.2","prettier":"^3.5.3","pump":"^1.0.1","rcedit":"^1.1.0","rimraf":"^2.2.8","sinon":"^12.0.1","sinon-test":"^3.1.3","source-map":"0.6.1","source-map-support":"^0.3.2","style-loader":"^3.3.2","tar":"^7.5.9","ts-loader":"^9.5.1","tsec":"0.2.7","tslib":"^2.6.3","typescript":"^6.0.0-dev.20260130","typescript-eslint":"^8.45.0","util":"^0.12.4","webpack":"^5.105.0","webpack-cli":"^5.1.4","webpack-stream":"^7.0.0","xml2js":"^0.5.0","yaserver":"^0.4.0"},"overrides":{"node-gyp-build":"4.8.1","kerberos@2.1.1":{"node-addon-api":"7.1.0"},"lodash-es":"4.18.1"},"optionalDependencies":{"windows-foreground-love":"0.6.1"},"volta":{"node":"22.22.0"},"desktopName":"windsurf.desktop"};Zc.BUILD_INSERT_PACKAGE_CONFIGURATION&&(Zc=Yc("../package.json"));if(process.isEmbeddedApp){try{let o=Yc("../product.sub.json");ys=Object.assign(ys,o)}catch{}try{let o=Yc("../package.sub.json");Zc=Object.assign(Zc,o)}catch{}}var Lb={};if(process.env.VSCODE_DEV)try{Lb=Yc("../product.overrides.json"),ys=Object.assign(ys,Lb)}catch{}var Rr=ys,Ab=Zc;ai();(process.env.ELECTRON_RUN_AS_NODE||process.versions.electron)&&Hk(`data:text/javascript;base64,${Buffer.from(`
	export async function resolve(specifier, context, nextResolve) {
		if (specifier === 'fs') {
			return {
				format: 'builtin',
				shortCircuit: true,
				url: 'node:original-fs'
			};
		}

		// Defer to the next hook in the chain, which would be the
		// Node.js default resolve if this is the last user-specified loader.
		return nextResolve(specifier, context);
	}`).toString("base64")}`,import.meta.url);globalThis._VSCODE_PRODUCT_JSON={...Rr};globalThis._VSCODE_PACKAGE_JSON={...Ab};globalThis._VSCODE_FILE_ROOT=import.meta.dirname;var Hg;function Kk(){return Hg||(Hg=$k()),Hg}async function $k(){Ne("code/willLoadNls");let o,r;if(process.env.VSCODE_NLS_CONFIG)try{o=JSON.parse(process.env.VSCODE_NLS_CONFIG),o?.languagePack?.messagesFile?r=o.languagePack.messagesFile:o?.defaultMessagesFile&&(r=o.defaultMessagesFile),globalThis._VSCODE_NLS_LANGUAGE=o?.resolvedLanguage}catch(e){console.error(`Error reading VSCODE_NLS_CONFIG from environment: ${e}`)}if(!(process.env.VSCODE_DEV||!r)){try{globalThis._VSCODE_NLS_MESSAGES=JSON.parse((await xp.promises.readFile(r)).toString())}catch(e){if(console.error(`Error reading NLS messages file ${r}: ${e}`),o?.languagePack?.corruptMarkerFile)try{await xp.promises.writeFile(o.languagePack.corruptMarkerFile,"corrupted")}catch(t){console.error(`Error writing corrupted NLS marker file: ${t}`)}if(o?.defaultMessagesFile&&o.defaultMessagesFile!==r)try{globalThis._VSCODE_NLS_MESSAGES=JSON.parse((await xp.promises.readFile(o.defaultMessagesFile)).toString())}catch(t){console.error(`Error reading default NLS messages file ${o.defaultMessagesFile}: ${t}`)}}return Ne("code/didLoadNls"),o}}async function Ob(){await Kk()}var Ck=Db(Kg(),1);import{app as Xe,protocol as lO,crashReporter as cO,Menu as dO,contentTracing as uO}from"electron";$g();qg();ai();Se();ai();jt();import{promises as qi}from"fs";async function Lv({userLocale:o,osLocale:r,userDataPath:e,commit:t,nlsMetadataPath:n}){if(Ne("code/willGenerateNls"),process.env.VSCODE_DEV||o==="pseudo"||o.startsWith("en")||!t||!e)return bd(o,r,n);try{let i=await ID(e);if(!i)return bd(o,r,n);let s=bD(i,o);if(!s)return bd(o,r,n);let a=i[s],l=a?.translations?.vscode;if(!a||typeof a.hash!="string"||!a.translations||typeof l!="string"||!await q.exists(l))return bd(o,r,n);let c=`${a.hash}.${s}`,d=U(e,"clp",c),u=U(d,t),f=U(u,"nls.messages.json"),m=U(d,"tcf.json"),y=U(d,"corrupted.info");await q.exists(y)&&await qi.rm(d,{recursive:!0,force:!0,maxRetries:3});let v={userLocale:o,osLocale:r,resolvedLanguage:s,defaultMessagesFile:U(n,"nls.messages.json"),languagePack:{translationsConfigFile:m,messagesFile:f,corruptMarkerFile:y},locale:o,availableLanguages:{"*":s},_languagePackId:c,_languagePackSupport:!0,_translationsConfigFile:m,_cacheRoot:d,_resolvedLanguagePackCoreLocation:u,_corruptedFile:y};if(await q.exists(f))return SD(u).catch(()=>{}),Ne("code/didGenerateNls"),v;let[S,I,k]=await Promise.all([qi.readFile(U(n,"nls.keys.json"),"utf-8").then(F=>JSON.parse(F)),qi.readFile(U(n,"nls.messages.json"),"utf-8").then(F=>JSON.parse(F)),qi.readFile(l,"utf-8").then(F=>JSON.parse(F))]),R=[],D=0;for(let[F,ce]of S){let B=k.contents[F];for(let ee of ce)R.push(B?.[ee]||I[D]),D++}return await qi.mkdir(u,{recursive:!0}),await Promise.all([qi.writeFile(f,JSON.stringify(R),"utf-8"),qi.writeFile(m,JSON.stringify(a.translations),"utf-8")]),Ne("code/didGenerateNls"),v}catch(i){console.error("Generating translation files failed.",i)}return bd(o,r,n)}async function ID(o){let r=U(o,"languagepacks.json");try{return JSON.parse(await qi.readFile(r,"utf-8"))}catch{return}}function bD(o,r){try{for(;r;){if(o[r])return r;let e=r.lastIndexOf("-");if(e>0)r=r.substring(0,e);else return}}catch(e){console.error("Resolving language pack configuration failed.",e)}}function bd(o,r,e){return Ne("code/didGenerateNls"),{userLocale:o,osLocale:r,resolvedLanguage:"en",defaultMessagesFile:U(e,"nls.messages.json"),locale:o,availableLanguages:{}}}function SD(o){let r=new Date;return qi.utimes(o,r,r)}Va();Ne("code/didStartMain");Ne("code/willLoadMainBundle",{startTime:Math.floor(aO.timeOrigin)});Ne("code/didLoadMainBundle");var pO=Wb(Rr),Sn=IO(),Lg=mO(Sn);Sn.sandbox&&!Sn["disable-chromium-sandbox"]&&!Lg["disable-chromium-sandbox"]?Xe.enableSandbox():Xe.commandLine.hasSwitch("no-sandbox")&&!Xe.commandLine.hasSwitch("disable-gpu-sandbox")?Xe.commandLine.appendSwitch("disable-gpu-sandbox"):(Xe.commandLine.appendSwitch("no-sandbox"),Xe.commandLine.appendSwitch("disable-gpu-sandbox"));var zc=Ep(Sn,Rr.nameShort??"code-oss-dev");if(process.platform==="win32"){let o=pf(zc);o&&zi(o)}Xe.setPath("userData",zc);var Pk=SO();dO.setApplicationMenu(null);Ne("code/willStartCrashReporter");(Sn["crash-reporter-directory"]||Lg["enable-crash-reporter"]&&!Sn["disable-crash-reporter"])&&yO();Ne("code/didStartCrashReporter");pO.isPortable&&Xe.setAppLogsPath(Fn.join(zc,"logs"));lO.registerSchemesAsPrivileged([{scheme:"vscode-webview",privileges:{standard:!0,secure:!0,supportFetchAPI:!0,corsEnabled:!0,allowServiceWorkers:!0,codeCache:!0}},{scheme:"vscode-file",privileges:{secure:!0,standard:!0,supportFetchAPI:!0,corsEnabled:!0,codeCache:!0}}]);bO();var Eb,Tb=_k((Xe.getPreferredSystemLanguages()?.[0]??"en").toLowerCase()),vp=EO(Lg);vp&&(Eb=Lv({userLocale:vp,osLocale:Tb,commit:Rr.commit,userDataPath:zc,nlsMetadataPath:import.meta.dirname}));if(process.platform==="win32"||process.platform==="linux"){let o=!vp||vp==="qps-ploc"?"en":vp;Xe.commandLine.appendSwitch("lang",o)}Xe.once("ready",function(){if(Sn.trace){let o;if(Sn["trace-memory-infra"]){let r=Sn["trace-category-filter"]?.split(",")||[];r.push("disabled-by-default-memory-infra","disabled-by-default-memory-infra.v8.code_stats"),o={included_categories:r,excluded_categories:["*"],memory_dump_config:{allowed_dump_modes:["light","detailed"],triggers:[{type:"periodic_interval",mode:"detailed",min_time_between_dumps_ms:1e4},{type:"periodic_interval",mode:"light",min_time_between_dumps_ms:1e3}]}}}else o={categoryFilter:Sn["trace-category-filter"]||"*",traceOptions:Sn["trace-options"]||"record-until-full,enable-sampling"};uO.startRecording(o).finally(()=>Ek())}else Ek()});async function Ek(){Ne("code/mainAppReady");try{let[,o]=await Promise.all([xO(Pk),PO()]);await fO(Pk,o)}catch(o){console.error(o)}}async function fO(o,r){process.env.VSCODE_NLS_CONFIG=JSON.stringify(r),process.env.VSCODE_CODE_CACHE_PATH=o||"",await Ob(),await Promise.resolve().then(()=>(xk(),sO)),Ne("code/didRunMainBundle")}function mO(o){let r=["disable-hardware-acceleration","force-color-profile","disable-lcd-text","proxy-bypass-list","remote-debugging-port"];process.platform==="linux"&&(r.push("force-renderer-accessibility"),r.push("password-store"));let e=["enable-proposed-api","log-level","use-inmemory-secretstorage","enable-rdp-display-tracking"],t=hO();Object.keys(t).forEach(c=>{let d=t[c];if(r.indexOf(c)!==-1){if(d===!0||d==="true")c==="disable-hardware-acceleration"?Xe.disableHardwareAcceleration():Xe.commandLine.appendSwitch(c);else if(typeof d=="string"&&d)if(c==="password-store"){let u=d;(d==="gnome"||d==="gnome-keyring")&&(u="gnome-libsecret"),Xe.commandLine.appendSwitch(c,u)}else Xe.commandLine.appendSwitch(c,d)}else if(e.indexOf(c)!==-1)switch(c){case"enable-proposed-api":Array.isArray(d)?d.forEach(u=>u&&typeof u=="string"&&process.argv.push("--enable-proposed-api",u)):console.error("Unexpected value for `enable-proposed-api` in argv.json. Expected array of extension ids.");break;case"log-level":if(typeof d=="string")process.argv.push("--log",d);else if(Array.isArray(d))for(let u of d)process.argv.push("--log",u);break;case"use-inmemory-secretstorage":d&&process.argv.push("--use-inmemory-secretstorage");break;case"enable-rdp-display-tracking":d&&process.argv.push("--enable-rdp-display-tracking");break}});let n=`NetAdapterMaxBufSizeFeature:NetAdapterMaxBufSize/8192,DocumentPolicyIncludeJSCallStacksInCrashReports,EarlyEstablishGpuChannel,EstablishGpuChannelAsync,${Xe.commandLine.getSwitchValue("enable-features")}`;Xe.commandLine.appendSwitch("enable-features",n);let i=`CalculateNativeWinOcclusion,${Xe.commandLine.getSwitchValue("disable-features")}`;Xe.commandLine.appendSwitch("disable-features",i);let s=`FontMatchingCTMigration,StandardizedBrowserZoom,${Xe.commandLine.getSwitchValue("disable-blink-features")}`;Xe.commandLine.appendSwitch("disable-blink-features",s);let a=wO(o);a&&Xe.commandLine.appendSwitch("js-flags",a),Xe.commandLine.appendSwitch("xdg-portal-required-version","4"),Xe.commandLine.appendSwitch("max-active-webgl-contexts","32");let l="abcdefghijklmnopqrstuvwxyz".split("").map(c=>`MAP ${c}.localhost 127.0.0.1`).join(", ");return Xe.commandLine.appendSwitch("host-resolver-rules",l),t}function hO(){let o=vO(),r;try{r=Pp(Un.readFileSync(o).toString())}catch(e){e&&e.code==="ENOENT"?gO(o):console.warn(`Unable to read argv.json configuration file in ${o}, falling back to defaults (${e})`)}return r||(r={}),r}function gO(o){try{let r=Fn.dirname(o);Un.existsSync(r)||Un.mkdirSync(r),Un.writeFileSync(o,["// This configuration file allows you to pass permanent command line arguments to VS Code.","// Only a subset of arguments is currently supported to reduce the likelihood of breaking","// the installation.","//","// PLEASE DO NOT CHANGE WITHOUT UNDERSTANDING THE IMPACT","//","// NOTE: Changing this file requires a restart of VS Code.","{","	// Use software rendering instead of hardware accelerated rendering.","	// This can help in cases where you see rendering issues in VS Code.",'	// "disable-hardware-acceleration": true',"}"].join(`
`))}catch(r){console.error(`Unable to create argv.json configuration file in ${o}, falling back to defaults (${r})`)}}function vO(){let o=process.env.VSCODE_PORTABLE;if(o)return Fn.join(o,"argv.json");let r=Rr.dataFolderName;return process.env.VSCODE_DEV&&(r=`${r}-dev`),Fn.join(Tk.homedir(),r,"argv.json")}function yO(){let o=Sn["crash-reporter-directory"],r="";if(o){if(o=Fn.normalize(o),Fn.isAbsolute(o)||(console.error(`The path '${o}' specified for --crash-reporter-directory must be absolute.`),Xe.exit(1)),!Un.existsSync(o))try{Un.mkdirSync(o,{recursive:!0})}catch{console.error(`The path '${o}' specified for --crash-reporter-directory does not seem to exist or cannot be created.`),Xe.exit(1)}console.log(`Found --crash-reporter-directory argument. Setting crashDumps directory to be '${o}'`),Xe.setPath("crashDumps",o)}else{let i=Rr.appCenter;if(i){let s=process.platform==="win32",a=process.platform==="linux",l=process.platform==="darwin",c=Lg["crash-reporter-id"];if(c&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(c)){if(s)switch(process.arch){case"x64":r=i["win32-x64"];break;case"arm64":r=i["win32-arm64"];break}else if(l)if(Rr.darwinUniversalAssetId)r=i["darwin-universal"];else switch(process.arch){case"x64":r=i.darwin;break;case"arm64":r=i["darwin-arm64"];break}else a&&(r=i["linux-x64"]);r=r.concat("&uid=",c,"&iid=",c,"&sid=",c);let u=process.argv,f=u.indexOf("--");f===-1?u.push("--crash-reporter-id",c):u.splice(f,0,"--crash-reporter-id",c)}}}let e=(Rr.crashReporter?Rr.crashReporter.productName:void 0)||Rr.nameShort,t=(Rr.crashReporter?Rr.crashReporter.companyName:void 0)||"Microsoft",n=!!(!process.env.VSCODE_DEV&&r&&!o);cO.start({companyName:t,productName:process.env.VSCODE_DEV?`${e} Dev`:e,submitURL:r,uploadToServer:n,compress:!0,ignoreSystemCrashHandler:!0})}function wO(o){let r=[];return o["js-flags"]&&r.push(o["js-flags"]),process.platform==="linux"&&r.push("--nodecommit_pooled_pages"),r.length>0?r.join(" "):null}function IO(){return(0,Ck.default)(process.argv,{string:["user-data-dir","locale","js-flags","crash-reporter-directory"],boolean:["disable-chromium-sandbox"],default:{sandbox:!0},alias:{"no-sandbox":"sandbox"}})}function bO(){let o=[];globalThis.macOpenFiles=o,Xe.on("open-file",function(t,n){o.push(n)});let r=[],e=function(t,n){t.preventDefault(),r.push(n)};Xe.on("will-finish-launching",function(){Xe.on("open-url",e)}),globalThis.getOpenUrls=function(){return Xe.removeListener("open-url",e),r}}function SO(){if(process.argv.indexOf("--no-cached-data")>0||process.env.VSCODE_DEV)return;let o=Rr.commit;if(o)return Fn.join(zc,"CachedData",o)}async function xO(o){if(typeof o=="string")try{return await Un.promises.mkdir(o,{recursive:!0}),o}catch{}}function _k(o){if(o.startsWith("zh")){let r=o.split("-")[1];return["hans","cn","sg","my"].includes(r)?"zh-cn":"zh-tw"}return o}async function PO(){let o=Eb?await Eb:void 0;if(o)return o;let r=Xe.getLocale();return r?(r=_k(r.toLowerCase()),Lv({userLocale:r,osLocale:Tb,commit:Rr.commit,userDataPath:zc,nlsMetadataPath:import.meta.dirname})):{userLocale:"en",osLocale:Tb,resolvedLanguage:"en",defaultMessagesFile:Fn.join(import.meta.dirname,"nls.messages.json"),locale:"en",availableLanguages:{}}}function EO(o){let r=Sn.locale;return r?r.toLowerCase():typeof o?.locale=="string"?o.locale.toLowerCase():void 0}
//# sourceMappingURL=https://cdn.windsurf.com/sourcemaps/c46c49e94b4d3f41181204d59809d8f1b2c48d68/core/main.js.map
