UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

7 lines 103 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[30513],{42778:function(t,e,i){i.a(t,async function(t,e){try{var o=i(40445),a=i(67576),n=i(10139),s=i(17062),l=t([s]);s=(l.then?(await l)():l)[0];class r extends s.V{get NO_AUTOMATION_TEXT(){return this.hass.localize("ui.panel.config.devices.automation.actions.no_actions")}get UNKNOWN_AUTOMATION_TEXT(){return this.hass.localize("ui.panel.config.devices.automation.actions.unknown_action")}constructor(){super(n.PV,n.am,t=>({device_id:t||"",domain:"",entity_id:""}))}}r=(0,o.Cg)([(0,a.EM)("ha-device-action-picker")],r),e()}catch(r){e(r)}})},6:function(t,e,i){i(62953);var o=i(40445),a=i(68462),n=i(38627),s=i(5124),l=i(67576),r=i(6412),c=i(1087);let d,h,p=t=>t;class u extends a.M{render(){const t={"mdc-form-field--align-end":this.alignEnd,"mdc-form-field--space-between":this.spaceBetween,"mdc-form-field--nowrap":this.nowrap};return(0,s.qy)(d||(d=p` <div class="mdc-form-field ${0}"> <slot></slot> <label class="mdc-label" @click="${0}"> <slot name="label">${0}</slot> </label> </div>`),(0,r.H)(t),this._labelClick,this.label)}_labelClick(){const t=this.input;if(t&&(t.focus(),!t.disabled))if("HA-CHECKBOX"===t.tagName)t.checked=!t.checked,(0,c.r)(t,"change");else t.click()}constructor(...t){super(...t),this.disabled=!1}}u.styles=[n.R,(0,s.AH)(h||(h=p`:host(:not([alignEnd])) ::slotted(ha-switch){margin-right:10px;margin-inline-end:10px;margin-inline-start:initial}.mdc-form-field{align-items:var(--ha-formfield-align-items,center);gap:var(--ha-space-1)}.mdc-form-field>label{direction:var(--direction);margin-inline-start:0;margin-inline-end:auto;padding:0}:host([disabled]) label{color:var(--disabled-text-color)}`))],(0,o.Cg)([(0,l.MZ)({type:Boolean,reflect:!0})],u.prototype,"disabled",void 0),u=(0,o.Cg)([(0,l.EM)("ha-formfield")],u)},59646:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),a=i(29344),n=i(5124),s=i(67576),l=i(88360),r=t([a]);a=(r.then?(await r)():r)[0];let c,d=t=>t;class h extends a.A{updated(t){super.updated(t),t.has("haptic")&&(this.haptic?this.addEventListener("change",this._forwardHaptic):this.removeEventListener("change",this._forwardHaptic))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",this._forwardHaptic)}static get styles(){return[a.A.styles,(0,n.AH)(c||(c=d`:host{--wa-form-control-toggle-size:var(--ha-switch-size, 24px);--wa-form-control-required-content:var(
            --ha-switch-required-marker,
            var(--ha-input-required-marker, "*")
          );--wa-form-control-required-content-offset:var(
            --ha-switch-required-marker-offset,
            0.1rem
          );--thumb-size:var(--ha-switch-thumb-size, 18px);--width:var(--ha-switch-width, 48px)}label{position:relative;height:max(var(--thumb-size),var(--wa-form-control-toggle-size))}label::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-width:var(--ha-switch-min-touch-size,40px);min-height:var(--ha-switch-min-touch-size,40px)}label.disabled::before{pointer-events:none}.switch{background-color:var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-resting));border-color:var(--ha-switch-border-color,var(--ha-color-border-neutral-normal))}label:not(.disabled) .input:focus-visible~.switch,label:not(.disabled):hover .switch{background-color:var(--ha-switch-background-color-hover,var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-hover)))}.checked .switch{background-color:var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-resting));border-color:var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud))}label:not(.disabled).checked .input:focus-visible~.switch,label:not(.disabled).checked:hover .switch{background-color:var(--ha-switch-checked-background-color-hover,var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-hover)));border-color:var(--ha-switch-checked-border-color-hover,var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud)))}.switch .thumb{background-color:var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal));border-color:var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal));border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);box-shadow:var(--ha-switch-thumb-box-shadow,var(--ha-box-shadow-s))}label:not(.disabled) .input:focus-visible~.switch .thumb,label:not(.disabled):hover .switch .thumb{background-color:var(--ha-switch-thumb-background-color-hover,var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal)));border-color:var(--ha-switch-thumb-border-color-hover,var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal)))}.checked .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal));border-color:var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal))}label:not(.disabled).checked .input:focus-visible~.switch .thumb,label:not(.disabled).checked:hover .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color-hover,var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal)));border-color:var(--ha-switch-checked-thumb-border-color-hover,var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal)))}label.disabled{opacity:var(--ha-switch-disabled-opacity, .3);cursor:not-allowed}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:0;outline-offset:none}label:not(.disabled) .input:focus-visible~.switch{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}:host(:empty) slot.label{display:none}`))]}constructor(...t){super(...t),this.haptic=!1,this._forwardHaptic=()=>{(0,l.j)(this,"light")}}}(0,o.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"haptic",void 0),h=(0,o.Cg)([(0,s.EM)("ha-switch")],h),e()}catch(c){e(c)}})},30780:function(t,e,i){i.d(e,{EN:function(){return r},I8:function(){return h},L_:function(){return d},MC:function(){return c},O$:function(){return a},bM:function(){return l},ix:function(){return n},rP:function(){return s}});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);const o="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",a={condition:"M4 2A2 2 0 0 0 2 4V12H4V8H6V12H8V4A2 2 0 0 0 6 2H4M4 4H6V6H4M22 15.5V14A2 2 0 0 0 20 12H16V22H20A2 2 0 0 0 22 20V18.5A1.54 1.54 0 0 0 20.5 17A1.54 1.54 0 0 0 22 15.5M20 20H18V18H20V20M20 16H18V14H20M5.79 21.61L4.21 20.39L18.21 2.39L19.79 3.61Z",delay:"M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M19.03,7.39L20.45,5.97C20,5.46 19.55,5 19.04,4.56L17.62,6C16.07,4.74 14.12,4 12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22C17,22 21,17.97 21,13C21,10.88 20.26,8.93 19.03,7.39M11,14H13V8H11M15,1H9V3H15V1Z",event:"M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5M11,3A6,6 0 0,1 17,9C17,10.7 16.29,12.23 15.16,13.33L14.16,12.88C15.28,11.96 16,10.56 16,9A5,5 0 0,0 11,4A5,5 0 0,0 6,9C6,11.05 7.23,12.81 9,13.58V14.66C6.67,13.83 5,11.61 5,9A6,6 0 0,1 11,3Z",play_media:"M8,5.14V19.14L19,12.14L8,5.14Z",service:"M12,5A2,2 0 0,1 14,7C14,7.24 13.96,7.47 13.88,7.69C17.95,8.5 21,11.91 21,16H3C3,11.91 6.05,8.5 10.12,7.69C10.04,7.47 10,7.24 10,7A2,2 0 0,1 12,5M22,19H2V17H22V19Z",wait_template:"M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",wait_for_trigger:"M12,9A2,2 0 0,1 10,7C10,5.89 10.9,5 12,5C13.11,5 14,5.89 14,7A2,2 0 0,1 12,9M12,14A2,2 0 0,1 10,12C10,10.89 10.9,10 12,10C13.11,10 14,10.89 14,12A2,2 0 0,1 12,14M12,19A2,2 0 0,1 10,17C10,15.89 10.9,15 12,15C13.11,15 14,15.89 14,17A2,2 0 0,1 12,19M20,10H17V8.86C18.72,8.41 20,6.86 20,5H17V4A1,1 0 0,0 16,3H8A1,1 0 0,0 7,4V5H4C4,6.86 5.28,8.41 7,8.86V10H4C4,11.86 5.28,13.41 7,13.86V15H4C4,16.86 5.28,18.41 7,18.86V20A1,1 0 0,0 8,21H16A1,1 0 0,0 17,20V18.86C18.72,18.41 20,16.86 20,15H17V13.86C18.72,13.41 20,11.86 20,10Z",repeat:o,repeat_count:o,repeat_while:o,repeat_until:o,repeat_for_each:o,choose:"M11,5H8L12,1L16,5H13V9.43C12.25,9.89 11.58,10.46 11,11.12V5M22,11L18,7V10C14.39,9.85 11.31,12.57 11,16.17C9.44,16.72 8.62,18.44 9.17,20C9.72,21.56 11.44,22.38 13,21.83C14.56,21.27 15.38,19.56 14.83,18C14.53,17.14 13.85,16.47 13,16.17C13.47,12.17 17.47,11.97 17.95,11.97V14.97L22,11M10.63,11.59C9.3,10.57 7.67,10 6,10V7L2,11L6,15V12C7.34,12.03 8.63,12.5 9.64,13.4C9.89,12.76 10.22,12.15 10.63,11.59Z",if:"M14,4L16.29,6.29L13.41,9.17L14.83,10.59L17.71,7.71L20,10V4M10,4H4V10L6.29,7.71L11,12.41V20H13V11.59L7.71,6.29",device_id:"M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z",stop:"M13 24C9.74 24 6.81 22 5.6 19L2.57 11.37C2.26 10.58 3 9.79 3.81 10.05L4.6 10.31C5.16 10.5 5.62 10.92 5.84 11.47L7.25 15H8V3.25C8 2.56 8.56 2 9.25 2S10.5 2.56 10.5 3.25V12H11.5V1.25C11.5 .56 12.06 0 12.75 0S14 .56 14 1.25V12H15V2.75C15 2.06 15.56 1.5 16.25 1.5C16.94 1.5 17.5 2.06 17.5 2.75V12H18.5V5.75C18.5 5.06 19.06 4.5 19.75 4.5S21 5.06 21 5.75V16C21 20.42 17.42 24 13 24Z",sequence:"M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z",parallel:"M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16",variables:"M21 2H3C1.9 2 1 2.9 1 4V20C1 21.1 1.9 22 3 22H21C22.1 22 23 21.1 23 20V4C23 2.9 22.1 2 21 2M21 20H3V6H21V20M16.6 8C18.1 9.3 19 11.1 19 13C19 14.9 18.1 16.7 16.6 18L15 17.4C16.3 16.4 17 14.7 17 13S16.3 9.6 15 8.6L16.6 8M7.4 8L9 8.6C7.7 9.6 7 11.3 7 13S7.7 16.4 9 17.4L7.4 18C5.9 16.7 5 14.9 5 13S5.9 9.3 7.4 8M12.1 12L13.5 10H15L12.8 13L14.1 16H12.8L12 14L10.6 16H9L11.3 12.9L10 10H11.3L12.1 12Z",set_conversation_response:"M12,8H4A2,2 0 0,0 2,10V14A2,2 0 0,0 4,16H5V20A1,1 0 0,0 6,21H8A1,1 0 0,0 9,20V16H12L17,20V4L12,8M21.5,12C21.5,13.71 20.54,15.26 19,16V8C20.53,8.75 21.5,10.3 21.5,12Z"},n=new Set(["variables"]),s=[{groups:{device_id:{},dynamicGroups:{}}},{titleKey:"ui.panel.config.automation.editor.actions.groups.helpers.label",groups:{helpers:{}}},{titleKey:"ui.panel.config.automation.editor.actions.groups.other.label",groups:{event:{},service:{},set_conversation_response:{},other:{}}}],l={condition:{},delay:{},wait_template:{},wait_for_trigger:{},repeat_count:{},repeat_while:{},repeat_until:{},repeat_for_each:{},choose:{},if:{},stop:{},sequence:{},parallel:{},variables:{}},r={repeat_count:{repeat:{count:2,sequence:[]}},repeat_while:{repeat:{while:[],sequence:[]}},repeat_until:{repeat:{until:[],sequence:[]}},repeat_for_each:{repeat:{for_each:{},sequence:[]}}},c=["ha-automation-action-choose","ha-automation-action-condition","ha-automation-action-if","ha-automation-action-parallel","ha-automation-action-repeat","ha-automation-action-sequence"],d=["choose","if","parallel","sequence","repeat_while","repeat_until"],h=["repeat_count","repeat_for_each","wait_for_trigger"]},45464:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{u:function(){return m}});i(16280),i(44114),i(18111),i(61701),i(33110),i(62953);var a=i(44537),n=i(82591),s=i(27167),l=i(28978),r=i(8185),c=i(24790),d=i(79800),h=i(10139),p=i(95350),u=i(84025),v=t([n,r,d]);[n,r,d]=v.then?(await v)():v;const g="ui.panel.config.automation.editor.actions.type",b=(t,e)=>{if(!e)return!0;const i=e[t];return!i||("entity"!==i.integration_type||!i.is_built_in)},m=(t,e,i,o,a=!1,n)=>{try{const s=_(t,e,i,o,a,n);if("string"!=typeof s)throw new Error(String(s));return s}catch(s){console.error(s);let t="Error in describing action";return s.message&&(t+=": "+s.message),t}},_=(t,e,i,o,v=!1,m)=>{if(i.alias&&!v)return i.alias;if(o||(o=(0,u.pq)(i)),"service"===o){const e=i,o=[],a=e.target||e.data;if("string"==typeof a&&(0,c.F)(a)&&o.push(t.localize(`${g}.service.description.target_template`,{name:"target"})),e.service_template||e.action&&(0,c.F)(e.action))return t.localize(o.length?`${g}.service.description.service_based_on_template`:`${g}.service.description.service_based_on_template_no_targets`,{targets:(0,r.c)(t.locale,o)});if(e.action){var _,y;const[i,o]=e.action.split(".",2),a=null===(_=t.services[i])||void 0===_||null===(_=_[o])||void 0===_?void 0:_.description_placeholders,n=t.localize(`component.${i}.services.${o}.name`,a)||(null===(y=t.services[i])||void 0===y||null===(y=y[o])||void 0===y?void 0:y.name);return e.metadata?n&&b(i,m)?`${(0,p.p$)(t.localize,i)}: ${n}`:n||e.action:t.localize(`${g}.service.description.service_based_on_name_no_targets`,{name:n?b(i,m)?`${(0,p.p$)(t.localize,i)}: ${n}`:n:e.action})}return t.localize(`${g}.service.description.service`)}if("delay"===o){const e=i;let o;return o="number"==typeof e.delay?t.localize(`${g}.delay.description.duration_string`,{string:(0,s.A)(e.delay)}):"string"==typeof e.delay?(0,c.F)(e.delay)?t.localize(`${g}.delay.description.duration_template`):t.localize(`${g}.delay.description.duration_string`,{string:e.delay||t.localize(`${g}.delay.description.duration_unknown`)}):e.delay?t.localize(`${g}.delay.description.duration_string`,{string:(0,n.nR)(t.locale,e.delay)}):t.localize(`${g}.delay.description.duration_string`,{string:t.localize(`${g}.delay.description.duration_unknown`)}),t.localize(`${g}.delay.description.full`,{duration:o})}if("wait_for_trigger"===o){const e=i,o=(0,a.e)(e.wait_for_trigger);return o&&0!==o.length?t.localize(`${g}.wait_for_trigger.description.wait_for_triggers`,{count:o.length}):t.localize(`${g}.wait_for_trigger.description.wait_for_a_trigger`)}if("variables"===o){const e=i;return t.localize(`${g}.variables.description.full`,{names:(0,r.c)(t.locale,Object.keys(e.variables))})}if("fire_event"===o){const e=i;return(0,c.F)(e.event)?t.localize(`${g}.event.description.full`,{name:t.localize(`${g}.event.description.template`)}):t.localize(`${g}.event.description.full`,{name:e.event})}if("wait_template"===o)return t.localize(`${g}.wait_template.description.full`);if("stop"===o){const e=i;return t.localize(`${g}.stop.description.full`,{hasReason:void 0!==e.stop?"true":"false",reason:e.stop})}if("if"===o){return void 0!==i.else?t.localize(`${g}.if.description.if_else`):t.localize(`${g}.if.description.if`)}if("choose"===o){const e=i;if(e.choose){const i=(0,a.e)(e.choose).length+(e.default?1:0);return t.localize(`${g}.choose.description.full`,{number:i})}return t.localize(`${g}.choose.description.no_action`)}if("repeat"===o){const e=i;let o="";if("count"in e.repeat){const i=e.repeat.count;o=t.localize(`${g}.repeat.description.count`,{count:i})}else if("while"in e.repeat){const i=(0,a.e)(e.repeat.while);o=t.localize(`${g}.repeat.description.while_count`,{count:i.length})}else if("until"in e.repeat){const i=(0,a.e)(e.repeat.until);o=t.localize(`${g}.repeat.description.until_count`,{count:i.length})}else if("for_each"in e.repeat){const i=(0,a.e)(e.repeat.for_each).map(t=>JSON.stringify(t));o=t.localize(`${g}.repeat.description.for_each`,{items:(0,r.c)(t.locale,i)})}return t.localize(`${g}.repeat.description.full`,{chosenAction:o})}if("check_condition"===o)return t.localize(`${g}.check_condition.description.full`,{condition:(0,d.p)(i,t,e)});if("device_action"===o){const o=i;if(!o.device_id)return t.localize(`${g}.device_id.description.no_device`);const a=(0,h.PV)(t.localize,t.states,e,o);if(a)return a;const n=t.states[o.entity_id];return o.type?`${o.type} ${n?(0,l.u)(n):o.entity_id}`:t.localize(`${g}.device_id.description.perform_device_action`,{device:n?(0,l.u)(n):o.entity_id})}if("sequence"===o){const e=i,o=(0,a.e)(e.sequence).length;return t.localize(`${g}.sequence.description.full`,{number:o})}if("parallel"===o){const e=i,o=(0,a.e)(e.parallel).length;return t.localize(`${g}.parallel.description.full`,{number:o})}if("set_conversation_response"===o){const e=i;return(0,c.F)(e.set_conversation_response)?t.localize(`${g}.set_conversation_response.description.template`):t.localize(`${g}.set_conversation_response.description.full`,{response:e.set_conversation_response})}return o};o()}catch(g){o(g)}})},24423:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(6412),l=i(69558),r=i(1087),c=i(10763),d=i(30780),h=i(84025),p=i(15702),u=i(57116),v=i(60232),g=t([c,p,v]);[c,p,v]=g.then?(await g)():g;let b,m,_,y,f=t=>t;class $ extends a.WF{render(){const t=this.yamlMode||!this.uiSupported,e=(0,v.MS)(this.action);return(0,a.qy)(b||(b=f` <div class="${0}"> ${0} </div> `),(0,s.H)({"card-content":!0,disabled:!this.indent&&(this.disabled||!1===this.action.enabled&&!this.yamlMode),yaml:t,indent:this.indent,card:!this.inSidebar}),t?(0,a.qy)(m||(m=f` ${0} <ha-yaml-editor .defaultValue="${0}" @value-changed="${0}" .readOnly="${0}"></ha-yaml-editor> `),this.uiSupported?a.s6:(0,a.qy)(_||(_=f` <ha-automation-editor-warning .alertTitle="${0}" .localize="${0}"></ha-automation-editor-warning> `),this.hass.localize("ui.panel.config.automation.editor.actions.unsupported_action"),this.hass.localize),this.action,this._onYamlChange,this.disabled):(0,a.qy)(y||(y=f` <div @value-changed="${0}"> ${0} </div> `),this._onUiChanged,(0,l._)(`ha-automation-action-${e}`,{hass:this.hass,action:this.action,disabled:this.disabled,narrow:this.narrow,optionsInSidebar:this.indent,indent:this.indent,inSidebar:this.inSidebar})))}_onYamlChange(t){t.stopPropagation(),t.detail.isValid&&(0,r.r)(this,this.inSidebar?"yaml-changed":"value-changed",{value:(0,h.Rn)(t.detail.value)})}_onUiChanged(t){t.stopPropagation();const e=Object.assign(Object.assign(Object.assign({},this.action.alias?{alias:this.action.alias}:{}),this.action.note?{note:this.action.note}:{}),t.detail.value);(0,r.r)(this,"value-changed",{value:e})}expandAll(){var t,e;null===(t=this._collapsibleElement)||void 0===t||null===(e=t.expandAll)||void 0===e||e.call(t)}collapseAll(){var t,e;null===(t=this._collapsibleElement)||void 0===t||null===(e=t.collapseAll)||void 0===e||e.call(t)}constructor(...t){super(...t),this.disabled=!1,this.yamlMode=!1,this.indent=!1,this.selected=!1,this.narrow=!1,this.inSidebar=!1,this.uiSupported=!1}}$.styles=[u.yj,u.aM],(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],$.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"yamlMode",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],$.prototype,"indent",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],$.prototype,"selected",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],$.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"sidebar"})],$.prototype,"inSidebar",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"supported"})],$.prototype,"uiSupported",void 0),(0,o.Cg)([(0,n.P)("ha-yaml-editor")],$.prototype,"yamlEditor",void 0),(0,o.Cg)([(0,n.P)(d.MC.join(", "))],$.prototype,"_collapsibleElement",void 0),$=(0,o.Cg)([(0,n.EM)("ha-automation-action-editor")],$),e()}catch(b){e(b)}})},60232:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{MS:function(){return Xt},Pb:function(){return Jt}});i(74423),i(18111),i(20116),i(13579),i(3362),i(42762),i(62953);var a=i(40445),n=(i(68825),i(35211)),s=i(34271),l=i(53289),r=i(5124),c=i(67576),d=i(22786),h=i(44537),p=i(93905),u=i(1087),v=i(99124),g=i(57237),b=i(71727),m=i(68246),_=i(52943),y=i(53516),f=i(78978),$=i(63130),w=i(56214),C=i(20543),A=i(7822),M=(i(76776),i(29823)),V=(i(70947),i(11382),i(26300)),H=i(65329),L=i(34127),k=i(30780),S=i(87225),x=i(12596),z=i(22792),O=i(84025),Z=i(45464),q=i(38859),E=i(65063),I=i(41570),j=i(49053),R=i(15702),D=i(57116),B=i(62711),P=i(24423),F=i(35877),T=i(49707),N=i(67909),U=i(83108),W=i(57826),Y=i(75107),Q=i(23063),K=i(49063),G=i(85933),X=i(19809),J=i(66710),tt=i(11864),et=i(88166),it=i(21446),ot=t([w,C,A,M,V,H,L,R,B,P,F,T,N,U,W,Y,Q,G,X,J,tt,et,it,K,Z]);[w,C,A,M,V,H,L,R,B,P,F,T,N,U,W,Y,Q,G,X,J,tt,et,it,K,Z]=ot.then?(await ot)():ot;let at,nt,st,lt,rt,ct,dt,ht,pt,ut,vt,gt,bt,mt,_t,yt,ft,$t,wt,Ct,At,Mt,Vt,Ht,Lt,kt,St,xt,zt=t=>t;const Ot="M18.75 22.16L16 19.16L17.16 18L18.75 19.59L22.34 16L23.5 17.41L18.75 22.16M13 13V7H11V13H13M13 17V15H11V17H13M12 2C17.5 2 22 6.5 22 12L21.91 13.31C21.31 13.11 20.67 13 20 13C16.69 13 14 15.69 14 19C14 19.95 14.22 20.85 14.62 21.65C13.78 21.88 12.91 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2Z",Zt="M6,2A4,4 0 0,1 10,6V8H14V6A4,4 0 0,1 18,2A4,4 0 0,1 22,6A4,4 0 0,1 18,10H16V14H18A4,4 0 0,1 22,18A4,4 0 0,1 18,22A4,4 0 0,1 14,18V16H10V18A4,4 0 0,1 6,22A4,4 0 0,1 2,18A4,4 0 0,1 6,14H8V10H6A4,4 0 0,1 2,6A4,4 0 0,1 6,2M16,18A2,2 0 0,0 18,20A2,2 0 0,0 20,18A2,2 0 0,0 18,16H16V18M14,10H10V14H14V10M6,16A2,2 0 0,0 4,18A2,2 0 0,0 6,20A2,2 0 0,0 8,18V16H6M8,6A2,2 0 0,0 6,4A2,2 0 0,0 4,6A2,2 0 0,0 6,8H8V6M18,8A2,2 0 0,0 20,6A2,2 0 0,0 18,4A2,2 0 0,0 16,6V8H18Z",qt="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",Et="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",It="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z",jt="M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M19,5V19H5V5H19M10,17L6,13L7.41,11.58L10,14.17L16.59,7.58L18,9",Rt="M9 22C8.45 22 8 21.55 8 21V18H4C2.9 18 2 17.11 2 16V4C2 2.89 2.9 2 4 2H20C21.11 2 22 2.9 22 4V16C22 17.11 21.11 18 20 18H13.9L10.2 21.71C10 21.9 9.75 22 9.5 22H9M10 16V19.08L13.08 16H20V4H4V16H10M15.84 8.2L14.83 9.21L12.76 7.18L13.77 6.16C13.97 5.95 14.31 5.94 14.55 6.16L15.84 7.41C16.05 7.62 16.06 7.96 15.84 8.2M8 11.91L12.17 7.72L14.24 9.8L10.08 14H8V11.91Z",Dt="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M6,7H18V9H6V7M6,11H15V13H6V11Z",Bt="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",Pt="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z",Ft="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z",Tt="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",Nt="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",Ut="M8,5.14V19.14L19,12.14L8,5.14Z",Wt="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M10,16.5L16,12L10,7.5V16.5Z",Yt="M3 6V8H14V6H3M3 10V12H14V10H3M20 10.1C19.9 10.1 19.7 10.2 19.6 10.3L18.6 11.3L20.7 13.4L21.7 12.4C21.9 12.2 21.9 11.8 21.7 11.6L20.4 10.3C20.3 10.2 20.2 10.1 20 10.1M18.1 11.9L12 17.9V20H14.1L20.2 13.9L18.1 11.9M3 14V16H10V14H3Z",Qt="M16,8H14V11H11V13H14V16H16V13H19V11H16M2,12C2,9.21 3.64,6.8 6,5.68V3.5C2.5,4.76 0,8.09 0,12C0,15.91 2.5,19.24 6,20.5V18.32C3.64,17.2 2,14.79 2,12M15,3C10.04,3 6,7.04 6,12C6,16.96 10.04,21 15,21C19.96,21 24,16.96 24,12C24,7.04 19.96,3 15,3M15,19C11.14,19 8,15.86 8,12C8,8.14 11.14,5 15,5C18.86,5 22,8.14 22,12C22,15.86 18.86,19 15,19Z",Kt="M18,17H10.5L12.5,15H18M6,17V14.5L13.88,6.65C14.07,6.45 14.39,6.45 14.59,6.65L16.35,8.41C16.55,8.61 16.55,8.92 16.35,9.12L8.47,17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",Gt="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4M9,9V15H15V9",Xt=(0,d.A)(t=>{if(t)return"action"in t?(0,O.pq)(t):S.I8.some(e=>e in t)?"condition":Object.keys(k.O$).find(e=>e in t)}),Jt=(t,e)=>{var i,o;e.stopPropagation();const a=null===(i=e.target)||void 0===i?void 0:i.name;if(!a)return;const n=(null===(o=e.detail)||void 0===o?void 0:o.value)||e.target.value;if((t.action[a]||"")===n)return;let s;n?s=Object.assign(Object.assign({},t.action),{},{[a]:n}):(s=Object.assign({},t.action),delete s[a]),(0,u.r)(t,"value-changed",{value:s})};class te extends r.WF{get selected(){return this._selected}firstUpdated(t){super.firstUpdated(t),this.root&&(this._collapsed=!1)}willUpdate(t){if(t.has("yamlMode")&&(this._warnings=void 0),!t.has("action"))return;const e=Xt(this.action);this._uiModeAvailable=void 0!==e&&!k.ix.has(e),this._uiModeAvailable||this._yamlMode||(this._yamlMode=!0)}disconnectedCallback(){super.disconnectedCallback(),this._runResultTimeout&&clearTimeout(this._runResultTimeout)}_renderOverflowLabel(t,e){return(0,r.qy)(at||(at=zt` <div class="overflow-label"> ${0} ${0} </div> `),t,this.optionsInSidebar&&!this.narrow?e||(0,r.qy)(nt||(nt=zt`<span class="shortcut-placeholder ${0}"></span>`),I.c?"mac":""):r.s6)}_renderRow(){var t,e,i,o,a,n,s;const l=Xt(this.action),c="service"===l&&this.action.action,d=c&&"target"in((null===(t=this.hass.services)||void 0===t||null===(t=t[(0,b.m)(c)])||void 0===t?void 0:t[(0,m.Y)(c)])||{})&&("homeassistant.reload_config_entry"!==this.action.action||!(null!==(e=this.action.data)&&void 0!==e&&e.entry_id)),h=d?this._extractTargets(this.action):"device_id"===l&&this.action.device_id?{device_id:this.action.device_id}:void 0,p="service"===l&&c?null===(i=this.hass.services)||void 0===i||null===(i=i[(0,b.m)(c)])||void 0===i||null===(i=i[(0,m.Y)(c)])||void 0===i?void 0:i.target:void 0,u=(0,y.C)((null===(o=this.action.note)||void 0===o?void 0:o.trim())||"",250);return(0,r.qy)(st||(st=zt` ${0} <h3 slot="header"> ${0} ${0} ${0} ${0} </h3> <ha-automation-row-event-chip .show="${0}" .variant="${0}" slot="event" aria-live="polite" .interactive="${0}" class="event-chip" @click="${0}" @keydown="${0}"> ${0} </ha-automation-row-event-chip> <slot name="icons" slot="icons"></slot> <ha-dropdown slot="icons" @click="${0}" @keydown="${0}" @wa-select="${0}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}"></ha-icon-button> <ha-dropdown-item value="run"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="rename" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="edit_note"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="duplicate" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="copy" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="cut" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> ${0} ${0} <ha-dropdown-item value="toggle_yaml_mode" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="disable" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> ${0} <ha-dropdown-item value="delete" variant="danger" .disabled="${0}"> <ha-svg-icon class="warning" slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> </ha-dropdown> ${0} `),"service"===l&&"action"in this.action&&this.action.action?(0,r.qy)(lt||(lt=zt` <ha-service-icon slot="leading-icon" class="action-icon" .hass="${0}" .service="${0}"></ha-service-icon> `),this.hass,this.action.action):"condition"===l&&this.optionsInSidebar&&"trigger"!==this.action.condition?(0,r.qy)(rt||(rt=zt`<ha-automation-condition-live-test id="condition-icon" slot="leading-icon" .hass="${0}" .condition="${0}"> <ha-svg-icon class="action-icon" .path="${0}"></ha-svg-icon> </ha-automation-condition-live-test>`),this.hass,this.action,k.O$[l]):(0,r.qy)(ct||(ct=zt` <ha-svg-icon slot="leading-icon" class="action-icon" .path="${0}"></ha-svg-icon> `),k.O$[l]),(0,_.Z)((0,Z.u)(this.hass,this._entityReg,this.action,void 0,!1,this._manifests)),void 0!==h||d&&!this._isNew?this._renderTargets(h,d&&!this._isNew,p,"device_id"!==l):r.s6,u?(0,r.qy)(dt||(dt=zt` <ha-svg-icon id="note-icon" tabindex="0" .path="${0}" .label="${0}" class="note-indicator"></ha-svg-icon><ha-tooltip for="note-icon"><p>${0}</p></ha-tooltip> `),Dt,this.hass.localize("ui.panel.config.automation.editor.note.label"),u):r.s6,"condition"!==l&&!0===this.action.continue_on_error?(0,r.qy)(ht||(ht=zt`<ha-svg-icon id="svg-icon" .path="${0}"></ha-svg-icon> <ha-tooltip for="svg-icon"> ${0} </ha-tooltip>`),Ot,this.hass.localize("ui.panel.config.automation.editor.actions.continue_on_error_description")):r.s6,this._running,null===(a=this._runResult)||void 0===a?void 0:a.variant,!(null===(n=this._runResult)||void 0===n||!n.details),this._showRunResultDetails,this._showRunResultDetails,null===(s=this._runResult)||void 0===s?void 0:s.title,v.C,g.d,this._handleDropdownSelect,this.hass.localize("ui.common.menu"),Nt,Ut,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.run")),this.disabled,Kt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.rename")),Rt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.note."+(this.action.note?"edit":"add"))),this.disabled,Qt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.duplicate")),this.disabled,Bt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.copy"),(0,r.qy)(pt||(pt=zt`<span class="shortcut"> <span>${0}</span> <span>+</span> <span>C</span> </span>`),I.c?(0,r.qy)(ut||(ut=zt`<ha-svg-icon .path="${0}"></ha-svg-icon>`),Zt):this.hass.localize("ui.panel.config.automation.editor.ctrl"))),this.disabled,Pt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.cut"),(0,r.qy)(vt||(vt=zt`<span class="shortcut"> <span>${0}</span> <span>+</span> <span>X</span> </span>`),I.c?(0,r.qy)(gt||(gt=zt`<ha-svg-icon .path="${0}"></ha-svg-icon>`),Zt):this.hass.localize("ui.panel.config.automation.editor.ctrl"))),this._pasteAvailable()?(0,r.qy)(bt||(bt=zt` <ha-dropdown-item value="paste"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> `),Ft,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.paste"),(0,r.qy)(mt||(mt=zt`<span class="shortcut"> <span>${0}</span> <span>+</span> <span>V</span> </span>`),I.c?(0,r.qy)(_t||(_t=zt`<ha-svg-icon .path="${0}"></ha-svg-icon>`),Zt):this.hass.localize("ui.panel.config.automation.editor.ctrl")))):r.s6,this.optionsInSidebar?r.s6:(0,r.qy)(yt||(yt=zt` <ha-dropdown-item value="move_up" .disabled="${0}"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon></ha-dropdown-item> <ha-dropdown-item value="move_down" .disabled="${0}"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon></ha-dropdown-item> `),this.disabled||!!this.first,this.hass.localize("ui.panel.config.automation.editor.move_up"),Et,this.disabled||!!this.last,this.hass.localize("ui.panel.config.automation.editor.move_down"),qt),!this._uiModeAvailable||!!this._warnings,Yt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.edit_"+(this._yamlMode?"ui":"yaml"))),this.disabled,!1===this.action.enabled?Wt:Gt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions."+(!1===this.action.enabled?"enable":"disable"))),"condition"!==l?(0,r.qy)(ft||(ft=zt`<ha-dropdown-item value="continue_on_error" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <wa-divider></wa-divider>`),this.disabled,this.action.continue_on_error?jt:It,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.continue_on_error"))):r.s6,this.disabled,Tt,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.delete"),(0,r.qy)($t||($t=zt`<span class="shortcut"> <span>${0}</span> <span>+</span> <span>${0}</span> </span>`),I.c?(0,r.qy)(wt||(wt=zt`<ha-svg-icon .path="${0}"></ha-svg-icon>`),Zt):this.hass.localize("ui.panel.config.automation.editor.ctrl"),this.hass.localize("ui.panel.config.automation.editor.del"))),this.optionsInSidebar?r.s6:(0,r.qy)(Ct||(Ct=zt`${0} <ha-automation-action-editor .hass="${0}" .action="${0}" .disabled="${0}" .yamlMode="${0}" .narrow="${0}" .uiSupported="${0}" @ui-mode-not-available="${0}"></ha-automation-action-editor>`),this._warnings?(0,r.qy)(At||(At=zt`<ha-automation-editor-warning .localize="${0}" .warnings="${0}"> </ha-automation-editor-warning>`),this.hass.localize,this._warnings):r.s6,this.hass,this.action,this.disabled,this._yamlMode,this.narrow,this._uiSupported(l),this._handleUiModeNotAvailable))}render(){if(!this.action)return r.s6;const t=Xt(this.action),e="repeat"===t?`repeat_${(0,K.m)(this.action.repeat)}`:t;return(0,r.qy)(Mt||(Mt=zt` <ha-card outlined> ${0} ${0} </ha-card> ${0} `),!1===this.action.enabled?(0,r.qy)(Vt||(Vt=zt` <div class="disabled-bar"> ${0} </div> `),this.hass.localize("ui.panel.config.automation.editor.actions.disabled")):r.s6,this.optionsInSidebar?(0,r.qy)(Ht||(Ht=zt`<ha-automation-row .disabled="${0}" .leftChevron="${0}" .collapsed="${0}" .selected="${0}" .highlight="${0}" .buildingBlock="${0}" .sortSelected="${0}" .dim="${0}" @click="${0}" @toggle-collapsed="${0}">${0}</ha-automation-row>`),!1===this.action.enabled,[...k.L_,...k.I8].includes(e)||"condition"===e&&S.I8.includes(this.action.condition),this._collapsed,this._selected,this.highlight,[...k.L_,...k.I8].includes(e),this.sortSelected,this._running,this._toggleSidebar,this._toggleCollapse,this._renderRow()):(0,r.qy)(Lt||(Lt=zt` <ha-expansion-panel left-chevron @expanded-changed="${0}"> ${0} </ha-expansion-panel> `),this._expansionPanelChanged,this._renderRow()),this.optionsInSidebar&&([...k.L_,...k.I8].includes(e)||"condition"===e&&S.I8.includes(this.action.condition))?(0,r.qy)(kt||(kt=zt`<ha-automation-action-editor class="${0}" .hass="${0}" .action="${0}" .narrow="${0}" .disabled="${0}" .uiSupported="${0}" indent .selected="${0}" @value-changed="${0}"></ha-automation-action-editor>`),this._collapsed?"hidden":"",this.hass,this.action,this.narrow,this.disabled,this._uiSupported(t),this._selected,this._onValueChange):r.s6)}_extractTargets(t){return t.target?t.target:t.entity_id?{entity_id:t.entity_id}:{}}_onValueChange(t){this._selected&&this.optionsInSidebar&&this.openSidebar(t.detail.value)}_setClipboard(){this._clipboard=Object.assign(Object.assign({},this._clipboard),{},{action:(0,s.A)(this.action)});let t=this.action;"sequence"in t&&(t=Object.assign(Object.assign({},this.action),{},{metadata:{}})),(0,$.l)((0,l.dump)(t))}_switchUiMode(){this._yamlMode=!1}_switchYamlMode(){this._yamlMode=!0}_handleUiModeNotAvailable(t){this._warnings=(0,f._)(this.hass,t.detail).warnings,this._yamlMode||(this._yamlMode=!0)}_expansionPanelChanged(t){t.detail.expanded||(this._isNew=!1)}_toggleSidebar(t){null==t||t.stopPropagation(),this._selected?(0,u.r)(this,"request-close-sidebar"):this.openSidebar()}markAsNew(){this._isNew=!0}openSidebar(t){const e=null!=t?t:this.action,i=Xt(e);(0,u.r)(this,"open-sidebar",{save:t=>{(0,u.r)(this,"value-changed",{value:t})},close:t=>{this._selected=!1,this._isNew=!1,(0,u.r)(this,"close-sidebar"),t&&this.focus()},rename:()=>{this._renameAction()},editNote:this._editNoteAction,toggleYamlMode:()=>{this._toggleYamlMode(),this.openSidebar()},disable:this._onDisable,continueOnError:this._continueOnError,delete:this._onDelete,copy:this._copyAction,cut:this._cutAction,paste:this._pasteAction,pasteAvailable:this._pasteAvailable,duplicate:this._duplicateAction,insertAfter:this._insertAfter,run:this._runAction,config:{action:e},uiSupported:!!i&&this._uiSupported(i),yamlMode:this._yamlMode}),this._selected=!0,this._collapsed=!1,this.narrow&&window.setTimeout(()=>{this.scrollIntoView({block:"start",behavior:"smooth"})},180)}expand(){this.optionsInSidebar?this._collapsed=!1:this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!0})}collapse(){this.optionsInSidebar?this._collapsed=!0:this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!1})}expandAll(){var t;this.expand(),null===(t=this._actionEditor)||void 0===t||t.expandAll()}collapseAll(){var t;this.collapse(),null===(t=this._actionEditor)||void 0===t||t.collapseAll()}_toggleCollapse(){this._collapsed=!this._collapsed}focus(){var t;null===(t=this._automationRowElement)||void 0===t||t.focus()}_handleDropdownSelect(t){var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e||null===(e=e.item)||void 0===e?void 0:e.value;if(i)switch(i){case"run":this._runAction();break;case"rename":this._renameAction();break;case"edit_note":this._editNoteAction();break;case"duplicate":this._duplicateAction();break;case"copy":this._copyAction();break;case"cut":this._cutAction();break;case"paste":this._pasteAction();break;case"move_up":this._moveUp();break;case"move_down":this._moveDown();break;case"toggle_yaml_mode":this._toggleYamlMode(t.target);break;case"disable":this._onDisable();break;case"continue_on_error":this._continueOnError();break;case"delete":this._onDelete()}}constructor(...t){super(...t),this.narrow=!1,this.disabled=!1,this.root=!1,this.optionsInSidebar=!1,this.sortSelected=!1,this._entityReg=[],this._uiModeAvailable=!0,this._yamlMode=!1,this._selected=!1,this._collapsed=!0,this._isNew=!1,this._running=!1,this._renderTargets=(0,d.A)((t,e=!1,i,o=!1)=>(0,r.qy)(St||(St=zt`<ha-automation-row-targets .target="${0}" .targetRequired="${0}" .selector="${0}" .interactive="${0}"></ha-automation-row-targets>`),t,e,i?{target:i}:void 0,o)),this._onDisable=()=>{var t;const e=!(null===(t=this.action.enabled)||void 0===t||t),i=Object.assign(Object.assign({},this.action),{},{enabled:e});var o;((0,u.r)(this,"value-changed",{value:i}),this._selected&&this.optionsInSidebar&&this.openSidebar(i),this._yamlMode&&!this.optionsInSidebar)&&(null===(o=this._actionEditor)||void 0===o||null===(o=o.yamlEditor)||void 0===o||o.setValue(i))},this._continueOnError=()=>{const t=Object.assign({},this.action);var e;(t.continue_on_error?delete t.continue_on_error:t.continue_on_error=!0,(0,u.r)(this,"value-changed",{value:t}),this._selected&&this.optionsInSidebar&&this.openSidebar(t),this._yamlMode&&!this.optionsInSidebar)&&(null===(e=this._actionEditor)||void 0===e||null===(e=e.yamlEditor)||void 0===e||e.setValue(t))},this._runAction=async()=>{this._runResultTimeout&&clearTimeout(this._runResultTimeout),requestAnimationFrame(()=>{this.scrollIntoViewIfNeeded?this.scrollIntoViewIfNeeded():this.scrollIntoView()}),this._running=!1,this._runResult=void 0;const t=await(0,x.$)(this.hass,{actions:this.action});if(t.actions.valid){const t=setTimeout(()=>{this._runResult={variant:"neutral",title:`${this.hass.localize("ui.panel.config.automation.editor.actions.running_action")}...`},this._running=!0},500);try{await(0,q.d)(this.hass,this.action),clearTimeout(t)}catch(e){clearTimeout(t),this._runResult={variant:"danger",title:this.hass.localize("ui.panel.config.automation.editor.actions.run_action_error"),details:e.message||e}}}else this._runResult={variant:"danger",title:this.hass.localize("ui.panel.config.automation.editor.actions.invalid_action"),details:t.actions.error};this._runResult&&"neutral"!==this._runResult.variant||(this._runResult={variant:"success",title:this.hass.localize("ui.panel.config.automation.editor.actions.run_action_success")}),this._running=!0,this._runResultTimeout=window.setTimeout(()=>{this._running=!1},2500)},this._showRunResultDetails=t=>{var e;null!==(e=this._runResult)&&void 0!==e&&e.details&&(t instanceof KeyboardEvent&&"Enter"!==t.key&&" "!==t.key||(t.stopPropagation(),(0,E.showAlertDialog)(this,{title:this._runResult.title,text:this._runResult.details})))},this._onDelete=()=>{(0,u.r)(this,"value-changed",{value:null}),this._selected&&(0,u.r)(this,"close-sidebar"),(0,j.c)(this,{message:this.hass.localize("ui.common.successfully_deleted"),duration:4e3,action:{text:this.hass.localize("ui.common.undo"),action:()=>{(0,u.r)(window,"undo-change")}}})},this._renameAction=async()=>{const t=await(0,E.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.actions.change_alias"),inputLabel:this.hass.localize("ui.panel.config.automation.editor.actions.alias"),inputType:"string",placeholder:(0,_.Z)((0,Z.u)(this.hass,this._entityReg,this.action,void 0,!0,this._manifests)),defaultValue:this.action.alias,confirmText:this.hass.localize("ui.common.submit")});if(null!==t){const i=Object.assign({},this.action);if(""===t?delete i.alias:i.alias=t,(0,u.r)(this,"value-changed",{value:i}),this._selected&&this.optionsInSidebar)this.openSidebar(i);else if(this._yamlMode){var e;null===(e=this._actionEditor)||void 0===e||null===(e=e.yamlEditor)||void 0===e||e.setValue(i)}}},this._editNoteAction=async()=>{const t=await(0,E.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.note."+(this.action.note?"edit":"add")),inputLabel:this.hass.localize("ui.panel.config.automation.editor.note.label"),inputType:"string",defaultValue:this.action.note,confirmText:this.hass.localize("ui.common.submit"),multiline:!0});if(null!==t){const i=Object.assign({},this.action);if(""===t?delete i.note:i.note=t,(0,u.r)(this,"value-changed",{value:i}),this._selected&&this.optionsInSidebar)this.openSidebar(i);else if(this._yamlMode){var e;null===(e=this._actionEditor)||void 0===e||null===(e=e.yamlEditor)||void 0===e||e.setValue(i)}}},this._duplicateAction=()=>{(0,u.r)(this,"duplicate")},this._insertAfter=t=>!(0,h.e)(t).some(t=>!(0,O.ve)(t))&&((0,u.r)(this,"insert-after",{value:t}),!0),this._copyAction=()=>{this._setClipboard(),this._selected&&this.optionsInSidebar&&this.openSidebar(),(0,j.c)(this,{message:this.hass.localize("ui.panel.config.automation.editor.actions.copied_to_clipboard"),duration:2e3})},this._cutAction=()=>{this._setClipboard(),(0,u.r)(this,"value-changed",{value:null}),this._selected&&(0,u.r)(this,"close-sidebar"),(0,j.c)(this,{message:this.hass.localize("ui.panel.config.automation.editor.actions.cut_to_clipboard"),duration:2e3})},this._pasteAction=()=>{var t;const e=null===(t=this._clipboard)||void 0===t?void 0:t.action;e&&(0,u.r)(this,"paste",{item:e})},this._pasteAvailable=()=>{var t;return!(null===(t=this._clipboard)||void 0===t||!t.action)},this._moveUp=()=>{(0,u.r)(this,"move-up")},this._moveDown=()=>{(0,u.r)(this,"move-down")},this._toggleYamlMode=t=>{this._yamlMode?this._switchUiMode():this._switchYamlMode(),this.optionsInSidebar?t&&this.openSidebar():this.expand()},this._uiSupported=(0,d.A)(t=>void 0!==customElements.get(`ha-automation-action-${t}`))}}te.styles=[D.bH,D.Lt,(0,r.AH)(xt||(xt=zt`ha-svg-icon#svg-icon{--icon-primary-color:var(--ha-color-fill-neutral-loud-active)}ha-svg-icon#svg-icon:hover{--icon-primary-color:var(--ha-color-fill-neutral-loud-hover)}`))],(0,a.Cg)([(0,c.MZ)({attribute:!1})],te.prototype,"hass",void 0),(0,a.Cg)([(0,c.MZ)({attribute:!1})],te.prototype,"action",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],te.prototype,"narrow",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],te.prototype,"disabled",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],te.prototype,"root",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],te.prototype,"first",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],te.prototype,"last",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean})],te.prototype,"highlight",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean,attribute:"sidebar"})],te.prototype,"optionsInSidebar",void 0),(0,a.Cg)([(0,c.MZ)({type:Boolean,attribute:"sort-selected"})],te.prototype,"sortSelected",void 0),(0,a.Cg)([(0,p.I)({key:"automationClipboard",state:!1,subscribe:!0,storage:"sessionStorage"})],te.prototype,"_clipboard",void 0),(0,a.Cg)([(0,c.wk)(),(0,n.Fg)({context:z.ih,subscribe:!0})],te.prototype,"_entityReg",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_uiModeAvailable",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_yamlMode",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_selected",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_collapsed",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_isNew",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_warnings",void 0),(0,a.Cg)([(0,c.wk)(),(0,n.Fg)({context:z.uW,subscribe:!0})],te.prototype,"_manifests",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_running",void 0),(0,a.Cg)([(0,c.wk)()],te.prototype,"_runResult",void 0),(0,a.Cg)([(0,c.P)("ha-automation-action-editor")],te.prototype,"_actionEditor",void 0),(0,a.Cg)([(0,c.P)("ha-automation-row")],te.prototype,"_automationRowElement",void 0),te=(0,a.Cg)([(0,c.EM)("ha-automation-action-row")],te),o()}catch(at){o(at)}})},68469:function(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(7588),i(62953),i(122);var o=i(40445),a=i(34271),n=i(5124),s=i(67576),l=i(75751),r=i(1087),c=i(57237),d=i(18350),h=(i(85938),i(67094),i(30780)),p=i(88249),u=(i(49053),i(82405)),v=i(41175),g=i(57116),b=i(60232),m=t([d,b]);[d,b]=m.then?(await m)():m;let _,y,f,$=t=>t;const w="M21 11H3V9H21V11M21 13H3V15H21V13Z",C="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class A extends((0,v.j)(n.WF)){get items(){return this.actions}set items(t){this.actions=t}setHighlightedItems(t){this.highlightedActions=t}render(){return(0,n.qy)(_||(_=$` <ha-sortable handle-selector=".handle" draggable-selector="ha-automation-action-row" .disabled="${0}" group="actions" invert-swap @item-moved="${0}" @item-added="${0}" @item-removed="${0}"> <div class="rows ${0}"> ${0} <div class="buttons"> <ha-button .disabled="${0}" @click="${0}" .appearance="${0}" .size="${0}"> <ha-svg-icon .path="${0}" slot="start"></ha-svg-icon> ${0} </ha-button> </div> </div> </ha-sortable> `),this.disabled,this.itemMoved,this.itemAdded,this.itemRemoved,this.optionsInSidebar?"":"no-sidebar",(0,l.u)(this.actions,t=>this.getKey(t),(t,e)=>{var i;return(0,n.qy)(y||(y=$` <ha-automation-action-row .root="${0}" .sortableData="${0}" .index="${0}" .first="${0}" .last="${0}" .action="${0}" .narrow="${0}" .disabled="${0}" @duplicate="${0}" @paste="${0}" @insert-after="${0}" @move-down="${0}" @move-up="${0}" @value-changed="${0}" .hass="${0}" .highlight="${0}" .optionsInSidebar="${0}" .sortSelected="${0}" @stop-sort-selection="${0}"> ${0} </ha-automation-action-row> `),this.root,t,e,0===e,e===this.actions.length-1,t,this.narrow,this.disabled,this.duplicateItem,this.pasteItem,this.insertAfter,this.moveDown,this.moveUp,this.itemChanged,this.hass,null===(i=this.highlightedActions)||void 0===i?void 0:i.includes(t),this.optionsInSidebar,this.rowSortSelected===e,this.stopSortSelection,this.disabled?n.s6:(0,n.qy)(f||(f=$` <div tabindex="0" class="handle ${0}" slot="icons" @keydown="${0}" @click="${0}" .index="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> `),this.rowSortSelected===e?"active":"",this.handleDragKeydown,c.d,e,w))}),this.disabled,this._addActionDialog,this.root?"accent":"filled",this.root?"medium":"small",C,this.hass.localize("ui.panel.config.automation.editor.actions.add"))}updated(t){if(super.updated(t),!this.hass)return;const e=(0,u.II)(this.hass.states,this.hass.devices,this.hass.areas,"action");if(t.has("actions")&&e&&(this._openedAddDialogFromQuery=!1),!this._openedAddDialogFromQuery&&this.root&&!this.disabled&&0===this.actions.length&&e?(this._openedAddDialogFromQuery=!0,queueMicrotask(()=>this._addActionDialog())):this._openedAddDialogFromQuery&&!e&&(this._openedAddDialogFromQuery=!1),t.has("actions")&&(this.focusLastItemOnChange||void 0!==this.focusItemIndexOnChange)){const t=this.focusLastItemOnChange?"new":"moved",e=this.shadowRoot.querySelector("ha-automation-action-row:"+("new"===t?"last-of-type":`nth-of-type(${this.focusItemIndexOnChange+1})`));this.focusLastItemOnChange=!1,this.focusItemIndexOnChange=void 0,e.updateComplete.then(()=>{const i=(0,b.MS)(e.action);!i||!this.optionsInSidebar||h.L_.includes(i)&&"moved"!==t||(e.openSidebar(),this.narrow&&e.scrollIntoView({block:"start",behavior:"smooth"})),"new"===t&&(e.expand(),e.markAsNew()),this.optionsInSidebar||e.focus()})}}expandAll(){var t;null===(t=this._actionRowElements)||void 0===t||t.forEach(t=>{t.expandAll()})}collapseAll(){var t;null===(t=this._actionRowElements)||void 0===t||t.forEach(t=>{t.collapseAll()})}_addActionDialog(){var t;this.narrow&&(0,r.r)(this,"request-close-sidebar"),(0,u.gZ)(this,{type:"action",add:this._addAction,clipboardItem:(0,b.MS)(null===(t=this._clipboard)||void 0===t?void 0:t.action),clipboardPasteToastBottomOffset:this.editorDirty?60:void 0})}constructor(...t){super(...t),this.root=!1,this.editorDirty=!1,this._openedAddDialogFromQuery=!1,this._addAction=(t,e)=>{let i;if(t===u.uV)i=this.actions.concat((0,a.A)(this._clipboard.action));else if(t in h.EN)i=this.actions.concat(h.EN[t]);else if((0,p.Q)(t))i=this.actions.concat({action:(0,p.Dt)(t),metadata:{},target:e});else{const e=customElements.get(`ha-automation-action-${t}`);i=this.actions.concat(e?Object.assign({},e.defaultConfig):{[t]:{}})}this.focusLastItemOnChange=!0,(0,r.r)(this,"value-changed",{value:i})}}}A.styles=g.Ju,(0,o.Cg)([(0,s.MZ)({type:Boolean})],A.prototype,"root",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:!1})],A.prototype,"editorDirty",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],A.prototype,"actions",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],A.prototype,"highlightedActions",void 0),(0,o.Cg)([(0,s.YG)("ha-automation-action-row")],A.prototype,"_actionRowElements",void 0),A=(0,o.Cg)([(0,s.EM)("ha-automation-action")],A),e()}catch(_){e(_)}})},35877:function(t,e,i){i.a(t,async function(t,e){try{i(3362),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(44537),l=i(1087),r=i(14503),c=i(83307),d=i(6650),h=i(57116),p=i(68469),u=t([c,d,p]);[c,d,p]=u.then?(await u)():u;let v,g,b,m=t=>t;class _ extends a.WF{static get defaultConfig(){return{choose:[{conditions:[],sequence:[]}]}}render(){const t=this.action,e=t.choose?(0,s.e)(t.choose):[];return(0,a.qy)(v||(v=m` <ha-automation-option .options="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" .narrow="${0}" .optionsInSidebar="${0}" .showDefaultActions="${0}" @show-default-actions="${0}"></ha-automation-option> ${0} `),e,this.disabled,this._optionsChanged,this.hass,this.narrow,this.indent,this._showDefault||!!t.default,this._addDefault,this._showDefault||t.default?(0,a.qy)(g||(g=m` <ha-automation-option-row .defaultActions="${0}" .narrow="${0}" .disabled="${0}" .hass="${0}" .optionsInSidebar="${0}" @value-changed="${0}"></ha-automation-option-row> `),(0,s.e)(t.default)||[],this.narrow,this.disabled,this.hass,this.indent,this._defaultChanged):a.s6)}async _addDefault(){var t,e;this._showDefault=!0,await(null===(t=this._defaultOptionRowElement)||void 0===t?void 0:t.updateComplete),null===(e=this._defaultOptionRowElement)||void 0===e||e.expand()}_optionsChanged(t){t.stopPropagation();const e=t.detail.value;(0,l.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{choose:e})})}_defaultChanged(t){t.stopPropagation(),this._showDefault=!0;const e=t.detail.value,i=Object.assign(Object.assign({},this.action),{},{default:e});0===e.length&&delete i.default,(0,l.r)(this,"value-changed",{value:i})}expandAll(){var t,e;null===(t=this._optionElement)||void 0===t||t.expandAll(),null===(e=this._defaultOptionRowElement)||void 0===e||e.expandAll()}collapseAll(){var t,e;null===(t=this._optionElement)||void 0===t||t.collapseAll(),null===(e=this._defaultOptionRowElement)||void 0===e||e.collapseAll()}static get styles(){return[r.RF,h.aM,(0,a.AH)(b||(b=m`ha-automation-option-row{display:block;margin-top:24px}h3{font-size:inherit;font-weight:inherit}`))]}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1,this._showDefault=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"indent",void 0),(0,o.Cg)([(0,n.wk)()],_.prototype,"_showDefault",void 0),(0,o.Cg)([(0,n.P)("ha-automation-option")],_.prototype,"_optionElement",void 0),(0,o.Cg)([(0,n.P)("ha-automation-option-row")],_.prototype,"_defaultOptionRowElement",void 0),_=(0,o.Cg)([(0,n.EM)("ha-automation-action-choose")],_),e()}catch(v){e(v)}})},49707:function(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(61701),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(22786),l=i(1087),r=i(76623),c=(i(70947),i(606)),d=i(88249),h=i(87225),p=i(95350),u=i(54706),v=i(49313),g=i(80081),b=i(30356),m=i(4601),_=i(97681),y=i(4519),f=i(93977),$=i(40998),w=i(60092),C=i(23484),A=i(52128),M=i(56860),V=t([c,v,g,b,m,_,y,f,$,w,C,A,M,r]);[c,v,g,b,m,_,y,f,$,w,C,A,M,r]=V.then?(await V)():V;let H,L,k,S,x,z,O,Z=t=>t;class q extends((0,u.E)(a.WF)){static get defaultConfig(){return{condition:"state"}}hassSubscribe(){return[(0,h.bn)(this.hass,t=>this._addConditions(t))]}_addConditions(t){this._conditionDescriptions=Object.assign(Object.assign({},this._conditionDescriptions),t)}render(){const t=h.I8.includes(this.action.condition),e=this.action.condition in this._conditionDescriptions?`${d.VH}${this.action.condition}`:this.action.condition;return(0,a.qy)(H||(H=Z` ${0} ${0} `),this.inSidebar||!this.inSidebar&&!this.indent?(0,a.qy)(L||(L=Z` <ha-generic-picker .hass="${0}" .label="${0}" .disabled="${0}" .value="${0}" .getItems="${0}" .rowRenderer="${0}" .valueRenderer="${0}" @value-changed="${0}"></ha-generic-picker> `),this.hass,this.hass.localize("ui.panel.config.automation.editor.conditions.type_select"),this.disabled,e,this._processedTypes(this._conditionDescriptions,this.hass.localize),this._rowRenderer,this._valueRenderer,this._typeChanged):a.s6,this.indent&&t||this.inSidebar&&!t||!this.indent&&!this.inSidebar?(0,a.qy)(k||(k=Z` <ha-automation-condition-editor .condition="${0}" .description="${0}" .disabled="${0}" .hass="${0}" @value-changed="${0}" .narrow="${0}" .uiSupported="${0}" .indent="${0}" action></ha-automation-condition-editor> `),this.action,this._conditionDescriptions[this.action.condition],this.disabled,this.hass,this._conditionChanged,this.narrow,this._uiSupported(this._getType(this.action,this._conditionDescriptions)),this.indent):a.s6)}_conditionChanged(t){t.stopPropagation(),(0,l.r)(this,"value-changed",{value:t.detail.value})}_typeChanged(t){t.stopPropagation();const e=t.detail.value;if(!e)return;if((0,d.Q)(e)){const t=(0,d.Dt)(e);return void(t!==this.action.condition&&(0,l.r)(this,"value-changed",{value:{condition:t}}))}const i=customElements.get(`ha-automation-condition-${e}`);e!==this.action.condition&&(0,l.r)(this,"value-changed",{value:Object.assign({},i.defaultConfig)})}expandAll(){var t;null===(t=this._conditionEditor)||void 0===t||t.expandAll()}collapseAll(){var t;null===(t=this._conditionEditor)||void 0===t||t.collapseAll()}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.inSidebar=!1,this.indent=!1,this._conditionDescriptions={},this._valueRenderer=t=>{const e=(0,d.Q)(t),i=e?(0,d.Dt)(t):t;let o;if(e){const t=(0,h.ob)(i),e=(0,h.YQ)(i);o=this.hass.localize(`component.${t}.conditions.${e}.name`)||i}else o=this.hass.localize(`ui.panel.config.automation.editor.conditions.type.${i}.label`)||i;return(0,a.qy)(S||(S=Z`<ha-condition-icon slot="start" .hass="${0}" .condition="${0}"></ha-condition-icon><span slot="headline">${0}</span>`),this.hass,i,o)},this._rowRenderer=t=>(0,a.qy)(x||(x=Z` <ha-combo-box-item type="button"> <ha-condition-icon slot="start" .hass="${0}" .condition="${0}"></ha-condition-icon> <span slot="headline">${0}</span> ${0} </ha-combo-box-item> `),this.hass,t.search_labels.condition||void 0,t.primary,t.secondary?(0,a.qy)(z||(z=Z`<span slot="supporting-text">${0}</span>`),t.secondary):a.s6),this._processedTypes=(0,s.A)((t,e)=>{const i=Object.keys(r.D).map(t=>{const i=e(`ui.panel.config.automation.editor.conditions.type.${t}.label`);return{id:t,primary:i,sorting_label:i,search_labels:{condition:t}}}),o=Object.keys(t).map(t=>{const i=(0,h.ob)(t),o=(0,h.YQ)(t),a=e(`component.${i}.conditions.${o}.name`)||t;return{id:`${d.VH}${t}`,primary:a,secondary:(0,p.p$)(this.hass.localize,i),sorting_label:a,search_labels:{condition:t,domain:i}}});return()=>[...i,...o]}),this._getType=(0,s.A)((t,e)=>t.condition in e?"platform":t.condition),this._uiSupported=(0,s.A)(t=>void 0!==customElements.get(`ha-automation-condition-${t}`))}}q.styles=(0,a.AH)(O||(O=Z`ha-generic-picker{margin-bottom:24px;display:block}`)),(0,o.Cg)([(0,n.MZ)({attribute:!1})],q.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],q.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],q.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],q.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"sidebar"})],q.prototype,"inSidebar",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"indent"})],q.prototype,"indent",void 0),(0,o.Cg)([(0,n.wk)()],q.prototype,"_conditionDescriptions",void 0),(0,o.Cg)([(0,n.P)("ha-automation-condition-editor")],q.prototype,"_conditionEditor",void 0),q=(0,o.Cg)([(0,n.EM)("ha-automation-action-condition")],q),e()}catch(H){e(H)}})},67909:function(t,e,i){i.a(t,async function(t,e){try{i(16280),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(1087),l=i(24790),r=i(39927),c=i(57673),d=t([r]);r=(d.then?(await d)():d)[0];let h,p=t=>t;class u extends a.WF{static get defaultConfig(){return{delay:""}}willUpdate(t){t.has("action")&&(this.action&&(0,l.r)(this.action)?(0,s.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.no_template_editor_support"))):this._timeData=(0,c.z)(this.action.delay))}render(){return(0,a.qy)(h||(h=p`<ha-duration-input .label="${0}" .disabled="${0}" .data="${0}" enable-millisecond required @value-changed="${0}"></ha-duration-input>`),this.hass.localize("ui.panel.config.automation.editor.actions.type.delay.delay"),this.disabled,this._timeData,this._valueChanged)}_valueChanged(t){t.stopPropagation();const e=t.detail.value;e&&(0,s.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{delay:e})})}constructor(...t){super(...t),this.disabled=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"action",void 0),(0,o.Cg)([(0,n.wk)()],u.prototype,"_timeData",void 0),u=(0,o.Cg)([(0,n.EM)("ha-automation-action-delay")],u),e()}catch(h){e(h)}})},83108:function(t,e,i){i.a(t,async function(t,e){try{i(16280),i(18111),i(7588),i(3362),i(62953);var o=i(40445),a=i(35211),n=i(5124),s=i(67576),l=i(22786),r=i(1087),c=i(42778),d=i(1798),h=i(52763),p=i(22792),u=i(10139),v=t([c,d,h]);[c,d,h]=v.then?(await v)():v;let g,b,m,_=t=>t;class y extends n.WF{static get defaultConfig(){return{device_id:"",domain:"",entity_id:""}}shouldUpdate(t){return!t.has("action")||(!this.action.device_id||this.action.device_id in this.hass.devices||((0,r.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.panel.config.automation.editor.edit_unknown_device"))),!1))}render(){var t;const e=this._deviceId||this.action.device_id;return(0,n.qy)(g||(g=_` <ha-device-picker .value="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" label="${0}"></ha-device-picker> <ha-device-action-picker .value="${0}" .deviceId="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" label="${0}"></ha-device-action-picker> ${0} `),e,this.disabled,this._devicePicked,this.hass,this.hass.localize("ui.panel.config.automation.editor.actions.type.device_id.label"),this.action,e,this.disabled,this._deviceActionPicked,this.hass,this.hass.localize("ui.panel.config.automation.editor.actions.type.device_id.action"),null!==(t=this._capabilities)&&void 0!==t&&null!==(t=t.extra_fields)&&void 0!==t&&t.length?(0,n.qy)(b||(b=_` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .disabled="${0}" .computeLabel="${0}" .computeHelper="${0}" @value-changed="${0}"></ha-form> `),this.hass,this._extraFieldsData(this.action,this._capabilities),this._capabilities.extra_fields,this.disabled,(0,u.T_)(this.hass.localize,this.action),(0,u.TH)(this.hass.localize,this.action),this._extraFieldsChanged):"")}firstUpdated(){this.hass.loadBackendTranslation("device_automation"),this._capabilities||this._getCapabilities(),this.action&&(this._origAction=this.action)}updated(t){const e=t.get("action");e&&!(0,u.Po)(this._entityReg,e,this.action)&&(this._deviceId=void 0,this._getCapabilities())}async _getCapabilities(){this._capabilities=this.action.domain?await(0,u.jR)(this.hass.callWS,this.action):void 0}_devicePicked(t){t.stopPropagation(),this._deviceId=t.target.value,void 0===this._deviceId&&(0,r.r)(this,"value-changed",{value:y.defaultConfig})}_deviceActionPicked(t){t.stopPropagation();let e=t.detail.value;this._origAction&&(0,u.Po)(this._entityReg,this._origAction,e)&&(e=this._origAction),(0,r.r)(this,"value-changed",{value:e})}_extraFieldsChanged(t){t.stopPropagation(),(0,r.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),t.detail.value)})}constructor(...t){super(...t),this.disabled=!1,this._entityReg=[],this._extraFieldsData=(0,l.A)((t,e)=>{const i={};return e.extra_fields.forEach(e=>{void 0!==t[e.name]&&(i[e.name]=t[e.name])}),i})}}y.styles=(0,n.AH)(m||(m=_`:host{display:block;margin-bottom:var(--ha-space-3)}ha-device-picker{display:block;margin-bottom:24px}ha-device-action-picker{display:block}ha-form{display:block;margin-top:24px}`)),(0,o.Cg)([(0,s.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],y.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Object})],y.prototype,"action",void 0),(0,o.Cg)([(0,s.wk)()],y.prototype,"_deviceId",void 0),(0,o.Cg)([(0,s.wk)()],y.prototype,"_capabilities",void 0),(0,o.Cg)([(0,s.wk)(),(0,a.Fg)({context:p.ih,subscribe:!0})],y.prototype,"_entityReg",void 0),y=(0,o.Cg)([(0,s.EM)("ha-automation-action-device_id")],y),e()}catch(g){e(g)}})},57826:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(1087),l=i(82474),r=i(99766),c=i(10763),d=i(91485),h=i(60232),p=t([l,r,c,d,h]);[l,r,c,d,h]=p.then?(await p)():p;let u,v=t=>t;class g extends a.WF{static get defaultConfig(){return{event:"",event_data:{}}}updated(t){t.has("action")&&(this._actionData&&this._actionData!==this.action.event_data&&this._yamlEditor&&this._yamlEditor.setValue(this.action.event_data),this._actionData=this.action.event_data)}render(){const{event:t,event_data:e}=this.action;return(0,a.qy)(u||(u=v` <ha-input .label="${0}" .value="${0}" .disabled="${0}" @change="${0}"></ha-input> <ha-yaml-editor .label="${0}" .name="${0}" .readOnly="${0}" .defaultValue="${0}" @value-changed="${0}"></ha-yaml-editor> `),this.hass.localize("ui.panel.config.automation.editor.actions.type.event.event"),t,this.disabled,this._eventChanged,this.hass.localize("ui.panel.config.automation.editor.actions.type.event.event_data"),"event_data",this.disabled,e,this._dataChanged)}_dataChanged(t){t.stopPropagation(),t.detail.isValid&&(this._actionData=t.detail.value,(0,h.Pb)(this,t))}_eventChanged(t){t.stopPropagation(),(0,s.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{event:t.target.value})})}constructor(...t){super(...t),this.disabled=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"action",void 0),(0,o.Cg)([(0,n.P)("ha-yaml-editor",!0)],g.prototype,"_yamlEditor",void 0),g=(0,o.Cg)([(0,n.EM)("ha-automation-action-event")],g),e()}catch(u){e(u)}})},75107:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(7588),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(1087),l=i(14503),r=i(68469),c=t([r]);r=(c.then?(await c)():c)[0];let d,h,p=t=>t;class u extends a.WF{static get defaultConfig(){return{if:[],then:[]}}render(){var t,e;const i=this.action;return(0,a.qy)(d||(d=p` <h4> ${0}: </h4> <ha-automation-condition .conditions="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" .narrow="${0}" .optionsInSidebar="${0}"></ha-automation-condition> <h4> ${0}: </h4> <ha-automation-action .actions="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" .narrow="${0}" .optionsInSidebar="${0}"></ha-automation-action> <h4> ${0}: </h4> <ha-automation-action .actions="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" .narrow="${0}" .optionsInSidebar="${0}"></ha-automation-action> `),this.hass.localize("ui.panel.config.automation.editor.actions.type.if.if"),null!==(t=i.if)&&void 0!==t?t:[],this.disabled,this._ifChanged,this.hass,this.narrow,this.indent,this.hass.localize("ui.panel.config.automation.editor.actions.type.if.then"),null!==(e=i.then)&&void 0!==e?e:[],this.disabled,this._thenChanged,this.hass,this.narrow,this.indent,this.hass.localize("ui.panel.config.automation.editor.actions.type.if.else"),i.else||[],this.disabled,this._elseChanged,this.hass,this.narrow,this.indent)}_ifChanged(t){t.stopPropagation();const e=t.detail.value;(0,s.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{if:e})})}_thenChanged(t){t.stopPropagation();const e=t.detail.value;(0,s.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{then:e})})}_elseChanged(t){t.stopPropagation();const e=t.detail.value,i=Object.assign(Object.assign({},this.action),{},{else:e});0===e.length&&delete i.else,(0,s.r)(this,"value-changed",{value:i})}expandAll(){var t,e;null===(t=this._conditionElement)||void 0===t||t.expandAll(),null===(e=this._actionElements)||void 0===e||e.forEach(t=>{var e;return null===(e=t.expandAll)||void 0===e?void 0:e.call(t)})}collapseAll(){var t,e;null===(t=this._conditionElement)||void 0===t||t.collapseAll(),null===(e=this._actionElements)||void 0===e||e.forEach(t=>{var e;return null===(e=t.collapseAll)||void 0===e?void 0:e.call(t)})}static get styles(){return[l.RF,(0,a.AH)(h||(h=p`h4{color:var(--secondary-text-color);margin-bottom:8px}h4:first-child{margin-top:0}`))]}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],u.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],u.prototype,"indent",void 0),(0,o.Cg)([(0,n.P)("ha-automation-condition")],u.prototype,"_conditionElement",void 0),(0,o.Cg)([(0,n.YG)("ha-automation-action")],u.prototype,"_actionElements",void 0),u=(0,o.Cg)([(0,n.EM)("ha-automation-action-if")],u),e()}catch(d){e(d)}})},23063:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(1087),l=i(14503),r=i(68469),c=t([r]);r=(c.then?(await c)():c)[0];let d,h=t=>t;class p extends a.WF{static get defaultConfig(){return{parallel:[]}}render(){const t=this.action;return(0,a.qy)(d||(d=h` <ha-automation-action .actions="${0}" .narrow="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" .optionsInSidebar="${0}"></ha-automation-action> `),t.parallel,this.narrow,this.disabled,this._actionsChanged,this.hass,this.indent)}_actionsChanged(t){t.stopPropagation();const e=t.detail.value;(0,s.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{parallel:e})})}expandAll(){var t;null===(t=this._actionElement)||void 0===t||t.expandAll()}collapseAll(){var t;null===(t=this._actionElement)||void 0===t||t.collapseAll()}static get styles(){return l.RF}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"indent",void 0),(0,o.Cg)([(0,n.P)("ha-automation-action")],p.prototype,"_actionElement",void 0),p=(0,o.Cg)([(0,n.EM)("ha-automation-action-parallel")],p),e()}catch(d){e(d)}})},49063:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{m:function(){return m}});i(44114),i(18111),i(7588),i(62953);var a=i(40445),n=i(5124),s=i(67576),l=i(22786),r=i(1087),c=i(14503),d=i(68469),h=i(24790),p=i(52763),u=t([d,p]);[d,p]=u.then?(await u)():u;let v,g=t=>t;const b=["count","while","until","for_each"],m=t=>b.find(e=>e in t);class _ extends n.WF{static get defaultConfig(){return{repeat:{count:2,sequence:[]}}}render(){const t=this.action.repeat,e=m(t),i=this._schema(null!=e?e:"count","count"in t&&"string"==typeof t.count&&(0,h.F)(t.count),this.inSidebar,this.indent),o=Object.assign(Object.assign({},t),{},{type:e});return(0,n.qy)(v||(v=g`<ha-form .hass="${0}" .data="${0}" .schema="${0}" .disabled="${0}" @value-changed="${0}" .computeLabel="${0}" .narrow="${0}"></ha-form>`),this.hass,o,i,this.disabled,this._valueChanged,this._computeLabelCallback,this.narrow)}_valueChanged(t){t.stopPropagation();const e=t.detail.value,i=e.type;delete e.type;if(i!==m(this.action.repeat)){var o,a;if("count"===i&&(e.count=2,delete e.while,delete e.until,delete e.for_each),"while"===i)e.while=null!==(o=e.until)&&void 0!==o?o:[],delete e.count,delete e.until,delete e.for_each;if("until"===i)e.until=null!==(a=e.while)&&void 0!==a?a:[],delete e.count,delete e.while,delete e.for_each;"for_each"===i&&(e.for_each={},delete e.count,delete e.while,delete e.until)}(0,r.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{repeat:Object.assign({},e)})})}static get styles(){return[c.RF]}_getSelectorElements(){if(this._formElement){var t;const e=null===(t=this._formElement.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ha-selector"),i=[];return null==e||e.forEach(t=>{var e;i.push(...Array.from((null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelectorAll("ha-selector-condition, ha-selector-action"))||[]))}),i}return[]}expandAll(){this._getSelectorElements().forEach(t=>{var e;null===(e=t.expandAll)||void 0===e||e.call(t)})}collapseAll(){this._getSelectorElements().forEach(t=>{var e;null===(e=t.collapseAll)||void 0===e||e.call(t)})}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.inSidebar=!1,this.indent=!1,this._schema=(0,l.A)((t,e,i,o)=>[..."count"!==t||!i&&(i||o)?[]:[{name:"count",required:!0,selector:e?{template:{}}:{number:{mode:"box",min:1}}}],..."until"!==t&&"while"!==t||!o&&(i||o)?[]:[{name:t,selector:{condition:{optionsInSidebar:o}}}],..."for_each"!==t||!i&&(i||o)?[]:[{name:"for_each",required:!0,selector:{object:{}}}],...o||!i&&!o?[{name:"sequence",selector:{action:{optionsInSidebar:o}}}]:[]]),this._computeLabelCallback=t=>{switch(t.name){case"count":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.count.label");case"while":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.while.conditions")+":";case"until":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.until.conditions")+":";case"for_each":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.type.for_each.items")+":";case"sequence":return this.hass.localize("ui.panel.config.automation.editor.actions.type.repeat.sequence")+":"}return""}}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],_.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],_.prototype,"narrow",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"action",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"sidebar"})],_.prototype,"inSidebar",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,attribute:"indent"})],_.prototype,"indent",void 0),(0,a.Cg)([(0,s.P)("ha-form")],_.prototype,"_formElement",void 0),_=(0,a.Cg)([(0,s.EM)("ha-automation-action-repeat")],_),o()}catch(v){o(v)}})},85933:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(1087),l=i(14503),r=i(68469),c=t([r]);r=(c.then?(await c)():c)[0];let d,h=t=>t;class p extends a.WF{static get defaultConfig(){return{sequence:[]}}render(){const{action:t}=this;return(0,a.qy)(d||(d=h` <ha-automation-action .actions="${0}" .narrow="${0}" .disabled="${0}" @value-changed="${0}" .hass="${0}" .optionsInSidebar="${0}"></ha-automation-action> `),t.sequence,this.narrow,this.disabled,this._actionsChanged,this.hass,this.indent)}_actionsChanged(t){t.stopPropagation();const e=t.detail.value;(0,s.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{sequence:e})})}expandAll(){var t;null===(t=this._actionElement)||void 0===t||t.expandAll()}collapseAll(){var t;null===(t=this._actionElement)||void 0===t||t.collapseAll()}static get styles(){return l.RF}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.indent=!1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"indent",void 0),(0,o.Cg)([(0,n.P)("ha-automation-action")],p.prototype,"_actionElement",void 0),p=(0,o.Cg)([(0,n.EM)("ha-automation-action-sequence")],p),e()}catch(d){e(d)}})},19809:function(t,e,i){i.a(t,async function(t,e){try{i(16280),i(74423),i(18111),i(13579),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(63533),l=i(1087),r=i(24790),c=(i(9503),i(67431)),d=i(91485),h=i(84025),p=t([c,d]);[c,d]=p.then?(await p)():p;let u,v,g,b,m,_=t=>t;class y extends a.WF{static get defaultConfig(){return{action:"",data:{}}}willUpdate(t){if(t.has("action")){try{(0,s.vA)(this.action,h.BD)}catch(e){return void(0,l.r)(this,"ui-mode-not-available",e)}this.action&&Object.entries(this.action).some(([t,e])=>!["data","target"].includes(t)&&(0,r.r)(e))?(0,l.r)(this,"ui-mode-not-available",Error(this.hass.localize("ui.errors.config.no_template_editor_support"))):this.action.entity_id?(this._action=Object.assign(Object.assign({},this.action),{},{data:Object.assign(Object.assign({},this.action.data),{},{entity_id:this.action.entity_id})}),delete this._action.entity_id):this._action=this.action}}render(){var t,e;if(!this._action)return a.s6;const[i,o]=this._action.action?this._action.action.split(".",2):[void 0,void 0],n=!(!i||!o)&&!(null===(t=this.hass.services[i])||void 0===t||null===(t=t[o])||void 0===t||null===(t=t.response)||void 0===t||!t.optional);return(0,a.qy)(u||(u=_` <ha-service-control .narrow="${0}" .hass="${0}" .value="${0}" .disabled="${0}" .hidePicker="${0}" @value-changed="${0}"></ha-service-control> ${0} `),this.narrow,this.hass,this._action,this.disabled,!!this._action.metadata,this._actionChanged,i&&o&&null!==(e=this.hass.services[i])&&void 0!==e&&null!==(e=e[o])&&void 0!==e&&e.response?(0,a.qy)(v||(v=_`<ha-settings-row .narrow="${0}"> ${0} <span slot="heading" class="${0}" @click="${0}">${0}</span> <span slot="description" class="${0}" @click="${0}"> ${0} </span> <ha-input .value="${0}" .required="${0}" .disabled="${0}" @change="${0}"></ha-input> </ha-settings-row>`),this.narrow,n?(0,a.qy)(g||(g=_`<ha-checkbox .checked="${0}" .disabled="${0}" @change="${0}" slot="prefix"></ha-checkbox>`),!!this._action.response_variable||this._responseChecked,this.disabled,this._responseCheckboxChanged):(0,a.qy)(b||(b=_`<div slot="prefix" class="checkbox-spacer"></div>`)),n?"clickable":"",n?this._toggleCheckbox:void 0,this.hass.localize("ui.panel.config.automation.editor.actions.type.service.response_variable"),n?"clickable":"",n?this._toggleCheckbox:void 0,n?this.hass.localize("ui.panel.config.automation.editor.actions.type.service.has_optional_response"):this.hass.localize("ui.panel.config.automation.editor.actions.type.service.has_response"),this._action.response_variable||"",!n,this.disabled||n&&!this._action.response_variable&&!this._responseChecked,this._responseVariableChanged):a.s6)}_actionChanged(t){t.detail.value===this._action&&t.stopPropagation();const e=Object.assign(Object.assign({},this.action),t.detail.value);if("response_variable"in this.action){var i;const[t,o]=this._action.action?this._action.action.split(".",2):[void 0,void 0];t&&o&&null!==(i=this.hass.services[t])&&void 0!==i&&i[o]&&!("response"in this.hass.services[t][o])&&(delete e.response_variable,this._responseChecked=!1)}(0,l.r)(this,"value-changed",{value:e})}_responseVariableChanged(t){const e=Object.assign(Object.assign({},this.action),{},{response_variable:t.target.value});t.target.value||delete e.response_variable,(0,l.r)(this,"value-changed",{value:e})}_toggleCheckbox(t){var e;const i=null===(e=t.currentTarget)||void 0===e||null===(e=e.parentElement)||void 0===e?void 0:e.querySelector("ha-checkbox");null==i||i.click()}_responseCheckboxChanged(t){if(this._responseChecked=t.target.checked,!this._responseChecked){const t=Object.assign({},this.action);delete t.response_variable,(0,l.r)(this,"value-changed",{value:t})}}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this._responseChecked=!1}}y.styles=(0,a.AH)(m||(m=_`ha-service-control{display:block;margin:0 -16px}ha-settings-row{margin:0 -16px;padding:var(--service-control-padding,0 16px)}ha-settings-row{--settings-row-content-width:100%;--settings-row-prefix-display:contents;border-top:var(--service-control-items-border-top,1px solid var(--divider-color))}.checkbox-spacer{width:32px}.clickable{cursor:pointer}`)),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],y.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],y.prototype,"narrow",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_action",void 0),(0,o.Cg)([(0,n.wk)()],y.prototype,"_responseChecked",void 0),y=(0,o.Cg)([(0,n.EM)("ha-automation-action-service")],y),e()}catch(u){e(u)}})},66710:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(52763),l=t([s]);s=(l.then?(await l)():l)[0];let r,c=t=>t;const d=[{name:"set_conversation_response",selector:{template:{}}}];class h extends a.WF{static get defaultConfig(){return{set_conversation_response:""}}render(){return(0,a.qy)(r||(r=c` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .disabled="${0}" .computeLabel="${0}"></ha-form> `),this.hass,this.action,d,this.disabled,this._computeLabelCallback)}constructor(...t){super(...t),this.disabled=!1,this._computeLabelCallback=()=>this.hass.localize("ui.panel.config.automation.editor.actions.type.set_conversation_response.label")}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],h.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],h.prototype,"disabled",void 0),h=(0,o.Cg)([(0,n.EM)("ha-automation-action-set_conversation_response")],h),e()}catch(r){e(r)}})},11864:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),a=i(35211),n=i(5124),s=i(67576),l=i(1087),r=(i(6),i(59646)),c=i(91485),d=i(22792),h=t([r,c]);[r,c]=h.then?(await h)():h;let p,u,v=t=>t;class g extends n.WF{static get defaultConfig(){return{stop:""}}render(){const{error:t,stop:e,response_variable:i}=this.action;return(0,n.qy)(p||(p=v` <ha-input .label="${0}" .value="${0}" .disabled="${0}" @change="${0}"></ha-input> <ha-input .label="${0}" .value="${0}" .disabled="${0}" @change="${0}"></ha-input> <ha-formfield .disabled="${0}" .label="${0}"> <ha-switch .disabled="${0}" .checked="${0}" @change="${0}"></ha-switch> </ha-formfield> `),this._i18n.localize("ui.panel.config.automation.editor.actions.type.stop.stop"),e,this.disabled,this._stopChanged,this._i18n.localize("ui.panel.config.automation.editor.actions.type.stop.response_variable"),i||"",this.disabled,this._responseChanged,this.disabled,this._i18n.localize("ui.panel.config.automation.editor.actions.type.stop.error"),this.disabled,null!=t&&t,this._errorChanged)}_stopChanged(t){t.stopPropagation(),(0,l.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{stop:t.target.value})})}_responseChanged(t){t.stopPropagation();const e=Object.assign({},this.action),i=t.target.value;i?e.response_variable=i:delete e.response_variable,(0,l.r)(this,"value-changed",{value:e})}_errorChanged(t){t.stopPropagation(),(0,l.r)(this,"value-changed",{value:Object.assign(Object.assign({},this.action),{},{error:t.target.checked})})}constructor(...t){super(...t),this.disabled=!1}}g.styles=(0,n.AH)(u||(u=v`ha-input{margin-bottom:var(--ha-space-6)}`)),(0,o.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"action",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,o.Cg)([(0,s.wk)(),(0,a.Fg)({context:d.D5,subscribe:!0})],g.prototype,"_i18n",void 0),g=(0,o.Cg)([(0,s.EM)("ha-automation-action-stop")],g),e()}catch(p){e(p)}})},88166:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(13579),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(22786),l=i(44537),r=i(24790),c=i(52763),d=i(53723),h=i(60232),p=t([c,d,h]);[c,d,h]=p.then?(await p)():p;let u,v,g,b,m=t=>t;class _ extends a.WF{static get defaultConfig(){return{wait_for_trigger:[]}}render(){const t=this.action.timeout,e="string"==typeof t&&(0,r.F)(t)?"string_template":"object"==typeof t&&null!==t&&Object.values(t).some(t=>"string"==typeof t&&(0,r.F)(t))?"object_template":"duration";return(0,a.qy)(u||(u=m` ${0} ${0} `),this.inSidebar||!this.inSidebar&&!this.indent?(0,a.qy)(v||(v=m` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .disabled="${0}" .computeLabel="${0}"></ha-form> `),this.hass,this.action,this._schema(e),this.disabled,this._computeLabelCallback):a.s6,this.indent||!this.inSidebar&&!this.indent?(0,a.qy)(g||(g=m`<ha-automation-trigger class="${0}" .triggers="${0}" .hass="${0}" .disabled="${0}" .name="${0}" @value-changed="${0}" .optionsInSidebar="${0}" .narrow="${0}"></ha-automation-trigger>`),this.inSidebar||this.indent?"":"expansion-panel",(0,l.e)(this.action.wait_for_trigger),this.hass,this.disabled,"wait_for_trigger",this._valueChanged,this.indent,this.narrow):a.s6)}_valueChanged(t){(0,h.Pb)(this,t)}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.inSidebar=!1,this.indent=!1,this._schema=(0,s.A)(t=>[{name:"timeout",required:!1,selector:"string_template"===t?{template:{}}:"object_template"===t?{object:{}}:{duration:{enable_millisecond:!0}}},{name:"continue_on_timeout",selector:{boolean:{}}}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.actions.type.wait_for_trigger.${"continue_on_timeout"===t.name?"continue_timeout":t.name}`)}}_.styles=(0,a.AH)(b||(b=m`ha-automation-trigger.expansion-panel{display:block;margin-top:24px}`)),(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"narrow",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"sidebar"})],_.prototype,"inSidebar",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"indent"})],_.prototype,"indent",void 0),_=(0,o.Cg)([(0,n.EM)("ha-automation-action-wait_for_trigger")],_),e()}catch(u){e(u)}})},21446:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(13579),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(22786),l=i(24790),r=i(52763),c=t([r]);r=(c.then?(await c)():c)[0];let d,h=t=>t;class p extends a.WF{static get defaultConfig(){return{wait_template:"",continue_on_timeout:!0}}render(){const t=this.action.timeout,e="string"==typeof t&&(0,l.F)(t)?"string_template":"object"==typeof t&&null!==t&&Object.values(t).some(t=>"string"==typeof t&&(0,l.F)(t))?"object_template":"duration";return(0,a.qy)(d||(d=h` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .disabled="${0}" .computeLabel="${0}"></ha-form> `),this.hass,this.action,this._schema(e),this.disabled,this._computeLabelCallback)}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,s.A)(t=>[{name:"wait_template",selector:{template:{}}},{name:"timeout",required:!1,selector:"string_template"===t?{template:{}}:"object_template"===t?{object:{}}:{duration:{enable_millisecond:!0}}},{name:"continue_on_timeout",selector:{boolean:{}}}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.automation.editor.actions.type.wait_template.${"continue_on_timeout"===t.name?"continue_timeout":t.name}`)}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"action",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"disabled",void 0),p=(0,o.Cg)([(0,n.EM)("ha-automation-action-wait_template")],p),e()}catch(d){e(d)}})},6650:function(t,e,i){i.a(t,async function(t,e){try{i(3362),i(42762),i(62953);var o=i(40445),a=i(35211),n=i(5124),s=i(67576),l=i(6412),r=i(44537),c=i(1087),d=i(99124),h=i(57237),p=i(52943),u=i(53516),v=i(56214),g=(i(76776),i(29823)),b=(i(70947),i(11382),i(26300)),m=(i(67094),i(79800)),_=i(22792),y=i(65063),f=i(41570),$=i(68469),w=i(40219),C=i(49053),A=i(57116),M=t([v,g,b,$,w,m]);[v,g,b,$,w,m]=M.then?(await M)():M;let V,H,L,k,S,x,z,O,Z,q,E,I,j,R,D=t=>t;const B="M6,2A4,4 0 0,1 10,6V8H14V6A4,4 0 0,1 18,2A4,4 0 0,1 22,6A4,4 0 0,1 18,10H16V14H18A4,4 0 0,1 22,18A4,4 0 0,1 18,22A4,4 0 0,1 14,18V16H10V18A4,4 0 0,1 6,22A4,4 0 0,1 2,18A4,4 0 0,1 6,14H8V10H6A4,4 0 0,1 2,6A4,4 0 0,1 6,2M16,18A2,2 0 0,0 18,20A2,2 0 0,0 20,18A2,2 0 0,0 18,16H16V18M14,10H10V14H14V10M6,16A2,2 0 0,0 4,18A2,2 0 0,0 6,20A2,2 0 0,0 8,18V16H6M8,6A2,2 0 0,0 6,4A2,2 0 0,0 4,6A2,2 0 0,0 6,8H8V6M18,8A2,2 0 0,0 20,6A2,2 0 0,0 18,4A2,2 0 0,0 16,6V8H18Z",P="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",F="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",T="M9 22C8.45 22 8 21.55 8 21V18H4C2.9 18 2 17.11 2 16V4C2 2.89 2.9 2 4 2H20C21.11 2 22 2.9 22 4V16C22 17.11 21.11 18 20 18H13.9L10.2 21.71C10 21.9 9.75 22 9.5 22H9M10 16V19.08L13.08 16H20V4H4V16H10M15.84 8.2L14.83 9.21L12.76 7.18L13.77 6.16C13.97 5.95 14.31 5.94 14.55 6.16L15.84 7.41C16.05 7.62 16.06 7.96 15.84 8.2M8 11.91L12.17 7.72L14.24 9.8L10.08 14H8V11.91Z",N="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M6,7H18V9H6V7M6,11H15V13H6V11Z",U="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",W="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",Y="M16,8H14V11H11V13H14V16H16V13H19V11H16M2,12C2,9.21 3.64,6.8 6,5.68V3.5C2.5,4.76 0,8.09 0,12C0,15.91 2.5,19.24 6,20.5V18.32C3.64,17.2 2,14.79 2,12M15,3C10.04,3 6,7.04 6,12C6,16.96 10.04,21 15,21C19.96,21 24,16.96 24,12C24,7.04 19.96,3 15,3M15,19C11.14,19 8,15.86 8,12C8,8.14 11.14,5 15,5C18.86,5 22,8.14 22,12C22,15.86 18.86,19 15,19Z",Q="M18,17H10.5L12.5,15H18M6,17V14.5L13.88,6.65C14.07,6.45 14.39,6.45 14.59,6.65L16.35,8.41C16.55,8.61 16.55,8.92 16.35,9.12L8.47,17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z";class K extends n.WF{get selected(){return this._selected}_expandedChanged(t){"option"===t.currentTarget.id&&(this._expanded=t.detail.expanded)}_getDescription(){const t=(0,r.e)(this.option.conditions);if(!t||0===t.length)return this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.no_conditions");let e="";return"string"==typeof t[0]?e+=t[0]:e+=(0,m.p)(t[0],this.hass,this._entityReg),t.length>1&&(e+=this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.option_description_additional",{numberOfAdditionalConditions:t.length-1})),e}_renderOverflowLabel(t,e){return(0,n.qy)(V||(V=D` <div class="overflow-label"> ${0} ${0} </div> `),t,this.optionsInSidebar&&!this.narrow?e||(0,n.qy)(H||(H=D`<span class="shortcut-placeholder ${0}"></span>`),f.c?"mac":""):n.s6)}_renderRow(){var t,e,i;const o=(0,u.C)((null===(t=this.option)||void 0===t||null===(t=t.note)||void 0===t?void 0:t.trim())||"",250);return(0,n.qy)(L||(L=D` <h3 slot="header"> ${0} ${0} </h3> <slot name="icons" slot="icons"></slot> ${0} ${0} `),this.option?`${this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.option",{number:this.index+1})}: ${this.option.alias||(this._expanded?"":this._getDescription())}`:this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.default"),null!==(e=this.option)&&void 0!==e&&null!==(e=e.note)&&void 0!==e&&e.trim()?(0,n.qy)(k||(k=D` <ha-svg-icon id="note-icon" tabindex="0" .path="${0}" .label="${0}" class="note-indicator"></ha-svg-icon> <ha-tooltip for="note-icon"><p>${0}</p></ha-tooltip> `),N,this.hass.localize("ui.panel.config.automation.editor.note.label"),o):n.s6,this.option?(0,n.qy)(S||(S=D` <ha-dropdown slot="icons" @click="${0}" @keydown="${0}" @wa-select="${0}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}"></ha-icon-button> <ha-dropdown-item value="rename" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="edit_note"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="duplicate" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> ${0} <ha-dropdown-item value="delete" variant="danger" .disabled="${0}"> <ha-svg-icon class="warning" slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> </ha-dropdown> `),d.C,h.d,this._handleDropdownSelect,this.hass.localize("ui.common.menu"),W,this.disabled,Q,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.triggers.rename")),T,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.note."+(null!==(i=this.option)&&void 0!==i&&i.note?"edit":"add"))),this.disabled,Y,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.duplicate")),this.optionsInSidebar?n.s6:(0,n.qy)(x||(x=D` <ha-dropdown-item value="move_up" .disabled="${0}"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon></ha-dropdown-item> <ha-dropdown-item value="move_down" .disabled="${0}"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon></ha-dropdown-item> `),this.disabled||!!this.first,this.hass.localize("ui.panel.config.automation.editor.move_up"),F,this.disabled||!!this.last,this.hass.localize("ui.panel.config.automation.editor.move_down"),P),this.disabled,U,this._renderOverflowLabel(this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.remove_option"),(0,n.qy)(z||(z=D`<span class="shortcut"> <span>${0}</span> <span>+</span> <span>${0}</span> </span>`),f.c?(0,n.qy)(O||(O=D`<ha-svg-icon .path="${0}"></ha-svg-icon>`),B):this.hass.localize("ui.panel.config.automation.editor.ctrl"),this.hass.localize("ui.panel.config.automation.editor.del")))):n.s6,this.optionsInSidebar?n.s6:this._renderContent())}_renderContent(){return(0,n.qy)(Z||(Z=D`<div class="${0}"> ${0} <h4 class="${0}"> ${0}: </h4> <ha-automation-action .actions="${0}" .disabled="${0}" .hass="${0}" .narrow="${0}" @value-changed="${0}" .optionsInSidebar="${0}"></ha-automation-action> </div>`),(0,l.H)({"card-content":!0,card:!this.optionsInSidebar,indent:this.optionsInSidebar,selected:this._selected,hidden:this.optionsInSidebar&&this._collapsed}),this.option?(0,n.qy)(q||(q=D` <h4 class="top"> ${0}: </h4> <ha-automation-condition .conditions="${0}" .disabled="${0}" .hass="${0}" .narrow="${0}" @value-changed="${0}" .optionsInSidebar="${0}"></ha-automation-condition> `),this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.conditions"),(0,r.e)(this.option.conditions),this.disabled,this.hass,this.narrow,this._conditionChanged,this.optionsInSidebar):n.s6,this.option?"":"top",this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.sequence"),this.option?(0,r.e)(this.option.sequence)||[]:this.defaultActions&&(0,r.e)(this.defaultActions)||[],this.disabled,this.hass,this.narrow,this._actionChanged,this.optionsInSidebar)}render(){return this.option||this.defaultActions?(0,n.qy)(E||(E=D` <ha-card outlined class="${0}"> ${0} </ha-card> ${0} `),this._selected?"selected":"",this.optionsInSidebar?(0,n.qy)(I||(I=D`<ha-automation-row left-chevron .collapsed="${0}" .selected="${0}" .sortSelected="${0}" @click="${0}" @toggle-collapsed="${0}" @delete-row="${0}">${0}</ha-automation-row>`),this._collapsed,this._selected,this.sortSelected,this._toggleSidebar,this._toggleCollapse,this._removeOption,this._renderRow()):(0,n.qy)(j||(j=D` <ha-expansion-panel left-chevron @expanded-changed="${0}" id="option"> ${0} </ha-expansion-panel> `),this._expandedChanged,this._renderRow()),this.optionsInSidebar?this._renderContent():n.s6):n.s6}_moveUp(){(0,c.r)(this,"move-up")}_moveDown(){(0,c.r)(this,"move-down")}_handleDropdownSelect(t){var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e||null===(e=e.item)||void 0===e?void 0:e.value;if(i)switch(i){case"rename":this._renameOption();break;case"edit_note":this._editNoteOption();break;case"delete":this._removeOption();break;case"duplicate":this._duplicateOption();break;case"move_up":this._moveUp();break;case"move_down":this._moveDown()}}_conditionChanged(t){t.stopPropagation();const e=t.detail.value,i=Object.assign(Object.assign({},this.option),{},{conditions:e});(0,c.r)(this,"value-changed",{value:i})}_actionChanged(t){if(this.defaultActions)return;t.stopPropagation();const e=t.detail.value,i=Object.assign(Object.assign({},this.option),{},{sequence:e});(0,c.r)(this,"value-changed",{value:i})}_toggleSidebar(t){null==t||t.stopPropagation(),this._selected?(0,c.r)(this,"request-close-sidebar"):this.openSidebar()}openSidebar(t){const e=null!=t?t:this.option;(0,c.r)(this,"open-sidebar",{close:t=>{this._selected=!1,(0,c.r)(this,"close-sidebar"),t&&this.focus()},rename:()=>{this._renameOption()},editNote:this._editNoteOption,delete:this._removeOption,duplicate:this._duplicateOption,defaultOption:!!this.defaultActions,note:null==e?void 0:e.note}),this._selected=!0,this._collapsed=!1,this.narrow&&window.setTimeout(()=>{this.scrollIntoView({block:"start",behavior:"smooth"})},180)}expand(){this.optionsInSidebar?this._collapsed=!1:this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!0})}collapse(){this._collapsed=!0}expandAll(){var t,e;this.expand(),null===(t=this._conditionElement)||void 0===t||t.expandAll(),null===(e=this._actionElement)||void 0===e||e.expandAll()}collapseAll(){var t,e;this.collapse(),null===(t=this._conditionElement)||void 0===t||t.collapseAll(),null===(e=this._actionElement)||void 0===e||e.collapseAll()}_toggleCollapse(){this._collapsed=!this._collapsed}focus(){var t;null===(t=this._automationRowElement)||void 0===t||t.focus()}static get styles(){return[A.bH,A.yj,A.Lt,A.aM,(0,n.AH)(R||(R=D`h4{color:var(--ha-color-text-secondary)}h4{margin-bottom:8px}h4.top{margin-top:0}`))]}constructor(...t){super(...t),this.narrow=!1,this.disabled=!1,this.first=!1,this.last=!1,this.optionsInSidebar=!1,this.sortSelected=!1,this._expanded=!1,this._selected=!1,this._collapsed=!0,this._entityReg=[],this._duplicateOption=()=>{(0,c.r)(this,"duplicate")},this._removeOption=()=>{this.option&&((0,c.r)(this,"value-changed",{value:null}),this._selected&&(0,c.r)(this,"close-sidebar"),(0,C.c)(this,{message:this.hass.localize("ui.common.successfully_deleted"),duration:4e3,action:{text:this.hass.localize("ui.common.undo"),action:()=>{(0,c.r)(window,"undo-change")}}}))},this._renameOption=async()=>{const t=await(0,y.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.change_alias"),inputLabel:this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.alias"),inputType:"string",placeholder:(0,p.Z)(this._getDescription()),defaultValue:this.option.alias,confirmText:this.hass.localize("ui.common.submit")});if(null!==t){const e=Object.assign({},this.option);""===t?delete e.alias:e.alias=t,(0,c.r)(this,"value-changed",{value:e})}},this._editNoteOption=async()=>{if(!this.option)return;const t=await(0,y.an)(this,{title:this.hass.localize("ui.panel.config.automation.editor.note."+(this.option.note?"edit":"add")),inputLabel:this.hass.localize("ui.panel.config.automation.editor.note.label"),inputType:"string",defaultValue:this.option.note,confirmText:this.hass.localize("ui.common.submit"),multiline:!0});if(null!==t){const e=Object.assign({},this.option);""===t?delete e.note:e.note=t,(0,c.r)(this,"value-changed",{value:e}),this._selected&&this.openSidebar(e)}}}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],K.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],K.prototype,"option",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],K.prototype,"defaultActions",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],K.prototype,"narrow",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],K.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Number})],K.prototype,"index",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],K.prototype,"first",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],K.prototype,"last",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"sidebar"})],K.prototype,"optionsInSidebar",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean,attribute:"sort-selected"})],K.prototype,"sortSelected",void 0),(0,o.Cg)([(0,s.wk)()],K.prototype,"_expanded",void 0),(0,o.Cg)([(0,s.wk)()],K.prototype,"_selected",void 0),(0,o.Cg)([(0,s.wk)()],K.prototype,"_collapsed",void 0),(0,o.Cg)([(0,s.wk)(),(0,a.Fg)({context:_.ih,subscribe:!0})],K.prototype,"_entityReg",void 0),(0,o.Cg)([(0,s.P)("ha-automation-condition")],K.prototype,"_conditionElement",void 0),(0,o.Cg)([(0,s.P)("ha-automation-action")],K.prototype,"_actionElement",void 0),(0,o.Cg)([(0,s.P)("ha-automation-row")],K.prototype,"_automationRowElement",void 0),K=(0,o.Cg)([(0,s.EM)("ha-automation-option-row")],K),e()}catch(V){e(V)}})},83307:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(7588),i(62953);var o=i(40445),a=i(5124),n=i(67576),s=i(75751),l=i(1087),r=i(57237),c=i(18350),d=(i(85938),i(67094),i(41175)),h=i(57116),p=i(6650),u=t([c,p]);[c,p]=u.then?(await u)():u;let v,g,b,m,_,y=t=>t;const f="M21 11H3V9H21V11M21 13H3V15H21V13Z",$="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class w extends((0,d.j)(a.WF)){get items(){return this.options}set items(t){this.options=t}render(){return(0,a.qy)(v||(v=y` <ha-sortable handle-selector=".handle" draggable-selector="ha-automation-option-row" .disabled="${0}" group="options" invert-swap @item-moved="${0}" @item-added="${0}" @item-removed="${0}"> <div class="rows ${0}"> ${0} <div class="buttons"> <ha-button appearance="filled" size="small" .disabled="${0}" @click="${0}"> <ha-svg-icon .path="${0}" slot="start"></ha-svg-icon> ${0} </ha-button> ${0} </div> </div> </ha-sortable> `),this.disabled,this.itemMoved,this.itemAdded,this.itemRemoved,this.optionsInSidebar?"":"no-sidebar",(0,s.u)(this.options,t=>this.getKey(t),(t,e)=>(0,a.qy)(g||(g=y` <ha-automation-option-row .sortableData="${0}" .index="${0}" .first="${0}" .last="${0}" .option="${0}" .narrow="${0}" .disabled="${0}" @duplicate="${0}" @move-down="${0}" @move-up="${0}" @value-changed="${0}" .hass="${0}" .optionsInSidebar="${0}" .sortSelected="${0}" @stop-sort-selection="${0}"> ${0} </ha-automation-option-row> `),t,e,0===e,e===this.options.length-1,t,this.narrow,this.disabled,this.duplicateItem,this.moveDown,this.moveUp,this.itemChanged,this.hass,this.optionsInSidebar,this.rowSortSelected===e,this.stopSortSelection,this.disabled?a.s6:(0,a.qy)(b||(b=y` <div tabindex="0" class="handle ${0}" slot="icons" @keydown="${0}" @click="${0}" .index="${0}"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> `),this.rowSortSelected===e?"active":"",this.handleDragKeydown,r.d,e,f))),this.disabled,this._addOption,$,this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.add_option"),this.showDefaultActions?a.s6:(0,a.qy)(m||(m=y`<ha-button appearance="plain" size="small" .disabled="${0}" @click="${0}"> <ha-svg-icon .path="${0}" slot="start"></ha-svg-icon> ${0} </ha-button>`),this.disabled,this._showDefaultActions,$,this.hass.localize("ui.panel.config.automation.editor.actions.type.choose.add_default")))}updated(t){if(super.updated(t),t.has("options")&&(this.focusLastItemOnChange||void 0!==this.focusItemIndexOnChange)){const t=this.focusLastItemOnChange?"new":"moved",e=this.shadowRoot.querySelector("ha-automation-option-row:"+("new"===t?"last-of-type":`nth-of-type(${this.focusItemIndexOnChange+1})`));this.focusLastItemOnChange=!1,this.focusItemIndexOnChange=void 0,e.updateComplete.then(()=>{this.narrow&&e.scrollIntoView({block:"start",behavior:"smooth"}),"new"===t&&e.expand(),this.optionsInSidebar?e.openSidebar():e.focus()})}}expandAll(){var t;null===(t=this._optionRowElements)||void 0===t||t.forEach(t=>t.expandAll())}collapseAll(){var t;null===(t=this._optionRowElements)||void 0===t||t.forEach(t=>t.collapseAll())}constructor(...t){super(...t),this.showDefaultActions=!1,this._addOption=()=>{const t=this.options.concat({conditions:[],sequence:[]});this.focusLastItemOnChange=!0,(0,l.r)(this,"value-changed",{value:t})},this._showDefaultActions=()=>{(0,l.r)(this,"show-default-actions")}}}w.styles=[h.Ju,(0,a.AH)(_||(_=y`:host([root]) .rows{padding-inline-end:8px}`))],(0,o.Cg)([(0,n.MZ)({attribute:!1})],w.prototype,"options",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"show-default"})],w.prototype,"showDefaultActions",void 0),(0,o.Cg)([(0,n.YG)("ha-automation-option-row")],w.prototype,"_optionRowElements",void 0),w=(0,o.Cg)([(0,n.EM)("ha-automation-option")],w),e()}catch(v){e(v)}})}}]);