"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["82158"],{5981:function(t,e,a){a.a(t,async function(t,s){try{a.r(e);a(18111),a(61701),a(3362),a(62953);var o=a(40445),i=a(96196),n=a(77845),l=a(1087),h=a(82286),r=a(18350),c=(a(48374),a(93444),a(26300)),d=(a(28732),a(606)),u=(a(75709),a(72554)),_=a(46049),p=a(14503),v=t([r,c,d,u]);[r,c,d,u]=v.then?(await v)():v;let b,g,m,f,$,y=t=>t;const O="M8,5.14V19.14L19,12.14L8,5.14Z",C="M18,18H6V6H18V18Z";class x extends i.WF{showDialog({stateObj:t}){this._stateObj=t,this._open=!0}closeDialog(){this._open=!1}_dialogClosed(){this._open=!1,this._stateObj=void 0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._stateObj)return i.s6;const t=(0,h.$)(this._stateObj,_.n.TONES)&&this._stateObj.attributes.available_tones,e=(0,h.$)(this._stateObj,_.n.VOLUME_SET),a=(0,h.$)(this._stateObj,_.n.DURATION);return(0,i.qy)(b||(b=y` <ha-dialog .open="${0}" .hass="${0}" header-title="${0}" @closed="${0}"> <div> <div class="options"> ${0} ${0} ${0} </div> <div class="controls"> <ha-control-button .label="${0}" @click="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </ha-control-button> <ha-control-button .label="${0}" @click="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </ha-control-button> </div> </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this.hass,this.hass.localize("ui.components.siren.advanced_controls"),this._dialogClosed,t?(0,i.qy)(g||(g=y` <ha-select .label="${0}" @selected="${0}" .value="${0}" .options="${0}"> </ha-select> `),this.hass.localize("ui.components.siren.tone"),this._handleToneChange,this._tone,Object.entries(this._stateObj.attributes.available_tones).map(([t,e])=>({value:Array.isArray(this._stateObj.attributes.available_tones)?e:t,label:e}))):i.s6,e?(0,i.qy)(m||(m=y` <ha-textfield type="number" .label="${0}" .suffix="${0}" .value="${0}" @change="${0}" .min="${0}" .max="${0}" .step="${0}"></ha-textfield> `),this.hass.localize("ui.components.siren.volume"),"%",this._volume?100*this._volume:void 0,this._handleVolumeChange,0,100,1):i.s6,a?(0,i.qy)(f||(f=y` <ha-textfield type="number" .label="${0}" .value="${0}" suffix="s" @change="${0}"></ha-textfield> `),this.hass.localize("ui.components.siren.duration"),this._duration,this._handleDurationChange):i.s6,this.hass.localize("ui.card.common.turn_on"),this._turnOn,O,this.hass.localize("ui.card.common.turn_off"),this._turnOff,C,this.closeDialog,this.hass.localize("ui.common.close"))}_handleToneChange(t){this._tone=t.detail.value}_handleVolumeChange(t){this._volume=parseFloat(t.target.value)/100,isNaN(this._volume)&&(this._volume=void 0)}_handleDurationChange(t){this._duration=parseInt(t.target.value),isNaN(this._duration)&&(this._duration=void 0)}async _turnOn(){await this.hass.callService("siren","turn_on",{entity_id:this._stateObj.entity_id,tone:this._tone,volume_level:this._volume,duration:this._duration})}async _turnOff(){await this.hass.callService("siren","turn_off",{entity_id:this._stateObj.entity_id})}static get styles(){return[p.RF,(0,i.AH)($||($=y`.options{display:flex;flex-direction:column;gap:var(--ha-space-4)}.controls{display:flex;flex-direction:row;justify-content:center;gap:var(--ha-space-4);margin-top:var(--ha-space-4)}ha-control-button{--control-button-border-radius:var(--ha-border-radius-xl);--mdc-icon-size:24px;width:64px;height:64px}`))]}constructor(...t){super(...t),this._open=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,o.Cg)([(0,n.wk)()],x.prototype,"_stateObj",void 0),(0,o.Cg)([(0,n.wk)()],x.prototype,"_open",void 0),(0,o.Cg)([(0,n.wk)()],x.prototype,"_tone",void 0),(0,o.Cg)([(0,n.wk)()],x.prototype,"_volume",void 0),(0,o.Cg)([(0,n.wk)()],x.prototype,"_duration",void 0),x=(0,o.Cg)([(0,n.EM)("ha-more-info-siren-advanced-controls")],x),s()}catch(b){s(b)}})}}]);
//# sourceMappingURL=82158.71fa8463e509d1c7.js.map