import { r as registerInstance, h } from './core-8e73947d.js';
var Notifier = /** @class */ (function () {
    function Notifier(hostRef) {
        registerInstance(this, hostRef);
    }
    Notifier.prototype.onTrigger = function (event) {
        if (event.detail.name == "close") {
            event.stopPropagation();
            this.notice = undefined;
        }
    };
    Notifier.prototype.onUpdatedNotice = function (newValue) {
        var _this = this;
        if (this.timer) {
            window.clearTimeout(this.timer);
            this.timer = undefined;
        }
        if (newValue != undefined) {
            this.timer = window.setTimeout(function () {
                _this.notice = undefined;
                _this.timer = undefined;
            }, 5000);
        }
    };
    Notifier.prototype.onNotice = function (event) {
        this.notice = event.detail;
    };
    Notifier.prototype.render = function () {
        var notice = !this.notice ? undefined : typeof (this.notice) == "string" ? JSON.parse(this.notice) : this.notice;
        var color = notice && notice.type != "default" ? notice.type : "primary";
        return notice == undefined ? h("slot", null) :
            [
                h("slot", null),
                h("aside", { class: notice.type }, h("p", null, notice.message, h("smoothly-trigger", { color: color, fill: "clear", name: "close" }, h("smoothly-icon", { name: "close-circle", color: color })))),
            ];
    };
    Object.defineProperty(Notifier, "watchers", {
        get: function () {
            return {
                "notice": ["onUpdatedNotice"]
            };
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Notifier, "style", {
        get: function () { return ".sc-smoothly-notifier-h{display:block}[hidden].sc-smoothly-notifier-h{display:none}smoothly-trigger.sc-smoothly-notifier{display:inline-block;vertical-align:middle;margin-left:1.5em}aside.sc-smoothly-notifier{text-align:center;vertical-align:middle;width:100%;height:2.8em}aside.warning.sc-smoothly-notifier{background-color:rgb(var(--smoothly-warning-tint));color:rgb(var(--smoothly-warning-contrast))}aside.success.sc-smoothly-notifier{background-color:rgb(var(--smoothly-success-tint));color:rgb(var(--smoothly-success-contrast))}aside.danger.sc-smoothly-notifier{background-color:rgb(var(--smoothly-danger-tint));color:rgb(var(--smoothly-danger-contrast))}aside.default.sc-smoothly-notifier{background-color:rgb(var(--smoothly-primary-tint));color:rgb(var(--smoothly-primary-contrast))}"; },
        enumerable: true,
        configurable: true
    });
    return Notifier;
}());
export { Notifier as smoothly_notifier };
