var __decorate=this&&this.__decorate||function(e,t,r,o){var a,i=arguments.length,l=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(l=(i<3?a(l):i>3?a(t,r,l):a(t,r))||l);return i>3&&l&&Object.defineProperty(t,r,l),l},__awaiter=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))(function(a,i){function l(e){try{n(o.next(e))}catch(e){i(e)}}function c(e){try{n(o.throw(e))}catch(e){i(e)}}function n(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(l,c)}n((o=o.apply(e,t||[])).next())})};import{html as e,LitElement as t}from"lit";import{customElement as r,property as o}from"lit/decorators.js";import"./modals/or-rule-alarm-modal";import"./forms/or-rule-form-alarm";import a from"@openremote/core";let OrRuleActionAlarm=class extends t{constructor(){super(...arguments),this._loadedUsers=[]}connectedCallback(){let e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});return __awaiter(this,void 0,void 0,function*(){yield this.loadUsers(),e.connectedCallback.call(this)})}loadUsers(){return __awaiter(this,void 0,void 0,function*(){let e=yield a.rest.api.UserResource.query({realmPredicate:{name:a.displayRealm}});200===e.status&&(this._loadedUsers=e.data.filter(e=>e.enabled&&!e.serviceAccount))})}render(){if(!this.action.alarm||!this.action.alarm.title)return e``;let t=this.action.alarm,r="";return t&&(r=e`
                        <or-rule-alarm-modal title="alarm." .action="${this.action}">
                            <or-rule-form-alarm .users="${this._loadedUsers}" .action="${this.action}"></or-rule-form-alarm>
                        </or-rule-alarm-modal>
                    `),e`${r}`}};__decorate([o({type:Object,attribute:!1})],OrRuleActionAlarm.prototype,"rule",void 0),__decorate([o({type:Object,attribute:!1})],OrRuleActionAlarm.prototype,"action",void 0),__decorate([o({type:String,attribute:!1})],OrRuleActionAlarm.prototype,"actionType",void 0),__decorate([o({type:Object})],OrRuleActionAlarm.prototype,"config",void 0),OrRuleActionAlarm=__decorate([r("or-rule-action-alarm")],OrRuleActionAlarm);export{OrRuleActionAlarm};