"use strict";
var __decorate = (this && this.__decorate) || function (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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OutputServiceImpl = void 0;
var inversify_1 = require("inversify");
var output_contribution_1 = require("@theia/output/lib/browser/output-contribution");
var output_channel_1 = require("@theia/output/lib/common/output-channel");
var OutputServiceImpl = /** @class */ (function () {
    function OutputServiceImpl() {
    }
    OutputServiceImpl.prototype.append = function (message) {
        var name = message.name, chunk = message.chunk;
        var channel = this.outputChannelManager.getChannel("Arduino: " + name);
        // Zen-mode: we do not reveal the output for daemon messages.
        var show = name === 'daemon'
            // This will open and reveal the view but won't show it. You will see the toggle bottom panel on the status bar.
            ? this.outputContribution.openView({ activate: false, reveal: false })
            // This will open, reveal but do not activate the Output view.
            : Promise.resolve(channel.show({ preserveFocus: true }));
        show.then(function () { return channel.append(chunk); });
    };
    __decorate([
        inversify_1.inject(output_contribution_1.OutputContribution),
        __metadata("design:type", output_contribution_1.OutputContribution)
    ], OutputServiceImpl.prototype, "outputContribution", void 0);
    __decorate([
        inversify_1.inject(output_channel_1.OutputChannelManager),
        __metadata("design:type", output_channel_1.OutputChannelManager)
    ], OutputServiceImpl.prototype, "outputChannelManager", void 0);
    OutputServiceImpl = __decorate([
        inversify_1.injectable()
    ], OutputServiceImpl);
    return OutputServiceImpl;
}());
exports.OutputServiceImpl = OutputServiceImpl;
//# sourceMappingURL=output-service-impl.js.map