import{_ as e,j as i,e as t,y as a,bA as o,d as n,n as l,a5 as s,O as c}from"./main-85e087f9.js";import{a as r}from"./c.388f6c87.js";import"./c.e651e5fa.js";import"./c.34b7552d.js";import"./c.c629b018.js";import"./c.8e28b461.js";import"./c.eab7754a.js";import"./c.d2f13ac1.js";import"./c.1024e243.js";import"./c.36ae07d6.js";import"./c.4f015773.js";import"./c.fea0de05.js";import"./c.7398f5d5.js";import"./c.99cf2c6d.js";import"./c.c128b7f4.js";import"./c.5fe2e3ab.js";import"./c.54067e61.js";e([l("ha-help-tooltip")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[t()],key:"label",value:void 0},{kind:"field",decorators:[t()],key:"position",value:()=>"top"},{kind:"method",key:"render",value:function(){return a` ${this.label} `}},{kind:"get",static:!0,key:"styles",value:function(){return n` ha-svg-icon { --mdc-icon-size: var(--ha-help-tooltip-size, 14px); color: var(--ha-help-tooltip-color, var(--disabled-text-color)); } `}}]}}),i);const d=["more-info","toggle","navigate","url","call-service","none"];e([l("hui-action-editor")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[t()],key:"config",value:void 0},{kind:"field",decorators:[t()],key:"label",value:void 0},{kind:"field",decorators:[t()],key:"actions",value:void 0},{kind:"field",decorators:[t()],key:"tooltipText",value:void 0},{kind:"field",decorators:[t()],key:"hass",value:void 0},{kind:"get",key:"_navigation_path",value:function(){const e=this.config;return(null==e?void 0:e.navigation_path)||""}},{kind:"get",key:"_url_path",value:function(){const e=this.config;return(null==e?void 0:e.url_path)||""}},{kind:"get",key:"_service",value:function(){const e=this.config;return(null==e?void 0:e.service)||""}},{kind:"field",key:"_serviceAction",value(){return s((e=>{var i;return{service:this._service,data:null!==(i=e.data)&&void 0!==i?i:e.service_data,target:e.target}}))}},{kind:"method",key:"render",value:function(){var e,i,t,o,n,l,s;if(!this.hass)return a``;const c=null!==(e=this.actions)&&void 0!==e?e:d;return a` ${"navigate"===(null===(o=this.config)||void 0===o?void 0:o.action)?a` `:""} ${"url"===(null===(n=this.config)||void 0===n?void 0:n.action)?a` `:""} ${"call-service"===(null===(l=this.config)||void 0===l?void 0:l.action)?a` `:""} `}},{kind:"method",key:"_actionPicked",value:function(e){var i;if(e.stopPropagation(),!this.hass)return;const t=e.target.value;if((null===(i=this.config)||void 0===i?void 0:i.action)===t)return;if("default"===t)return void c(this,"value-changed",{value:void 0});let a;switch(t){case"url":a={url_path:this._url_path};break;case"call-service":a={service:this._service};break;case"navigate":a={navigation_path:this._navigation_path}}c(this,"value-changed",{value:{action:t,...a}})}},{kind:"method",key:"_valueChanged",value:function(e){if(e.stopPropagation(),!this.hass)return;const i=e.target,t=e.target.value;this[`_${i.configValue}`]!==t&&i.configValue&&c(this,"value-changed",{value:{...this.config,[i.configValue]:t}})}},{kind:"method",key:"_serviceValueChanged",value:function(e){e.stopPropagation();const i={...this.config,service:e.detail.value.service||"",data:e.detail.value.data||{},target:e.detail.value.target||{}};"service_data"in i&&delete i.service_data,c(this,"value-changed",{value:i})}},{kind:"method",key:"_navigateValueChanged",value:function(e){e.stopPropagation();const i={...this.config,navigation_path:e.detail.value};c(this,"value-changed",{value:i})}},{kind:"get",static:!0,key:"styles",value:function(){return n` .dropdown { position: relative; } ha-help-tooltip { position: absolute; right: 40px; top: 16px; inset-inline-start: initial; inset-inline-end: 40px; direction: var(--direction); } ha-select, ha-textfield { width: 100%; } ha-service-control, ha-navigation-picker { display: block; } ha-textfield, ha-service-control, ha-navigation-picker { margin-top: 8px; } ha-service-control { --service-control-padding: 0; } `}}]}}),i);let h=e([l("ha-selector-ui-action")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[t()],key:"hass",value:void 0},{kind:"field",decorators:[t()],key:"selector",value:void 0},{kind:"field",decorators:[t()],key:"value",value:void 0},{kind:"field",decorators:[t()],key:"label",value:void 0},{kind:"field",decorators:[t()],key:"helper",value:void 0},{kind:"method",key:"render",value:function(){var e;return a` `}},{kind:"method",key:"_valueChanged",value:function(e){c(this,"value-changed",{value:e.detail.value})}}]}}),i);export{h as HaSelectorUiAction};