"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MainThreadStatusBar = void 0;
const tslib_1 = require("tslib");
const di_1 = require("@opensumi/di");
const ide_connection_1 = require("@opensumi/ide-connection");
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
const services_1 = require("@opensumi/ide-core-browser/lib/services");
const iconLabels_1 = require("@opensumi/monaco-editor-core/esm/vs/base/common/iconLabels");
const vscode_1 = require("../../../common/vscode");
const types = tslib_1.__importStar(require("../../../common/vscode/ext-types"));
let MainThreadStatusBar = class MainThreadStatusBar {
    constructor(rpcProtocol) {
        this.rpcProtocol = rpcProtocol;
        this.disposable = new ide_core_browser_1.Disposable();
        this.proxy = this.rpcProtocol.getProxy(vscode_1.ExtHostAPIIdentifier.ExtHostStatusBar);
    }
    dispose() {
        this.disposable.dispose();
    }
    $setStatusBarMessage(text) {
        this.disposable.addDispose(this.statusBar.addElement('ext_default_statusbar_text', {
            text,
            alignment: services_1.StatusBarAlignment.LEFT,
        }));
    }
    $dispose(entryId) {
        if (entryId) {
            this.statusBar.removeElement(entryId);
        }
        else {
            this.statusBar.removeElement('ext_default_statusbar_text');
        }
    }
    $createStatusBarItem(entryId, id, alignment, priority) {
        this.disposable.addDispose(this.statusBar.addElement(entryId, {
            id,
            alignment,
            priority,
        }));
    }
    async $setMessage(entryId, id, name, text, priority, alignment, color, backgroundColor, tooltip, accessibilityInformation, command, commandArgs) {
        const ariaLabel = (accessibilityInformation === null || accessibilityInformation === void 0 ? void 0 : accessibilityInformation.label) || (0, iconLabels_1.getCodiconAriaLabel)(text);
        const entry = {
            id,
            name,
            text: text || '',
            priority,
            alignment: alignment === types.StatusBarAlignment.Left ? services_1.StatusBarAlignment.LEFT : services_1.StatusBarAlignment.RIGHT,
            color,
            backgroundColor,
            tooltip,
            command,
            arguments: commandArgs,
            role: accessibilityInformation === null || accessibilityInformation === void 0 ? void 0 : accessibilityInformation.role,
            ariaLabel,
        };
        this.disposable.addDispose(this.statusBar.addElement(entryId, entry));
    }
};
exports.MainThreadStatusBar = MainThreadStatusBar;
tslib_1.__decorate([
    (0, di_1.Autowired)(ide_core_browser_1.CommandService),
    tslib_1.__metadata("design:type", Object)
], MainThreadStatusBar.prototype, "commandService", void 0);
tslib_1.__decorate([
    (0, di_1.Autowired)(services_1.IStatusBarService),
    tslib_1.__metadata("design:type", Object)
], MainThreadStatusBar.prototype, "statusBar", void 0);
exports.MainThreadStatusBar = MainThreadStatusBar = tslib_1.__decorate([
    (0, di_1.Injectable)({ multiple: true }),
    tslib_1.__param(0, (0, di_1.Optional)(Symbol())),
    tslib_1.__metadata("design:paramtypes", [Object])
], MainThreadStatusBar);
//# sourceMappingURL=main.thread.statusbar.js.map