"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MainThreadMessage = void 0;
const tslib_1 = require("tslib");
const di_1 = require("@opensumi/di");
const ide_connection_1 = require("@opensumi/ide-connection");
const ide_overlay_1 = require("@opensumi/ide-overlay");
const vscode_1 = require("../../../common/vscode");
let MainThreadMessage = class MainThreadMessage {
    constructor(rpcProtocol) {
        this.rpcProtocol = rpcProtocol;
        this.proxy = this.rpcProtocol.getProxy(vscode_1.ExtHostAPIIdentifier.ExtHostMessage);
    }
    dispose() { }
    async $showMessage(type, message, options, actions, from) {
        const action = options.modal
            ? await this.dialogService.open({ message, type, buttons: actions, options })
            : await this.messageService.open({ message, type, buttons: actions, closable: true, from });
        return action ? actions.indexOf(action) : undefined;
    }
};
exports.MainThreadMessage = MainThreadMessage;
tslib_1.__decorate([
    (0, di_1.Autowired)(ide_overlay_1.IDialogService),
    tslib_1.__metadata("design:type", Object)
], MainThreadMessage.prototype, "dialogService", void 0);
tslib_1.__decorate([
    (0, di_1.Autowired)(ide_overlay_1.IMessageService),
    tslib_1.__metadata("design:type", Object)
], MainThreadMessage.prototype, "messageService", void 0);
exports.MainThreadMessage = MainThreadMessage = tslib_1.__decorate([
    (0, di_1.Injectable)({ multiple: true }),
    tslib_1.__param(0, (0, di_1.Optional)(ide_connection_1.IRPCProtocol)),
    tslib_1.__metadata("design:paramtypes", [Object])
], MainThreadMessage);
//# sourceMappingURL=main.thread.message.js.map