UNPKG

iobroker.lovelace

Version:

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

1 lines 24.8 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[25529],{15090:function(e,t,i){i.d(t,{nP:function(){return l},vB:function(){return r}});i(44114),i(26910),i(18111),i(22489),i(61701),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var n=i(22675),a=i(52220),o=i(71727),s=i(69093);const r={alarm_control_panel:["armed_away","armed_custom_bypass","armed_home","armed_night","armed_vacation","arming","disarmed","disarming","pending","triggered"],alert:["on","off","idle"],assist_satellite:["idle","listening","responding","processing"],automation:["on","off"],binary_sensor:["on","off"],button:[],calendar:["on","off"],camera:["idle","recording","streaming"],cover:["closed","closing","open","opening"],device_tracker:["home","not_home"],fan:["on","off"],humidifier:["on","off"],infrared:[],input_boolean:["on","off"],input_button:[],lawn_mower:["error","paused","mowing","returning","docked"],light:["on","off"],lock:["jammed","locked","locking","unlocked","unlocking","opening","open"],media_player:["off","on","idle","playing","paused","standby","buffering"],person:["home","not_home"],plant:["ok","problem"],radio_frequency:[],remote:["on","off"],scene:[],schedule:["on","off"],script:["on","off"],siren:["on","off"],sun:["above_horizon","below_horizon"],switch:["on","off"],timer:["active","idle","paused"],update:["on","off"],vacuum:["cleaning","docked","error","idle","paused","returning"],valve:["closed","closing","open","opening"],weather:["clear-night","cloudy","exceptional","fog","hail","lightning-rainy","lightning","partlycloudy","pouring","rainy","snowy-rainy","snowy","sunny","windy-variant","windy"]},c={alarm_control_panel:{code_format:["number","text"]},binary_sensor:{device_class:["battery","battery_charging","co","cold","connectivity","door","garage_door","gas","heat","light","lock","moisture","motion","moving","occupancy","opening","plug","power","presence","problem","running","safety","smoke","sound","tamper","update","vibration","window"]},button:{device_class:["restart","update"]},camera:{frontend_stream_type:["hls","web_rtc"]},climate:{hvac_action:["off","idle","preheating","defrosting","heating","cooling","drying","fan"]},cover:{device_class:["awning","blind","curtain","damper","door","garage","gate","shade","shutter","window"]},device_tracker:{source_type:["bluetooth","bluetooth_le","gps","router"]},fan:{direction:["forward","reverse"]},humidifier:{device_class:["humidifier","dehumidifier"],action:["off","idle","humidifying","drying"]},media_player:{device_class:["tv","speaker","receiver"],media_content_type:["album","app","artist","channel","channels","composer","contributing_artist","episode","game","genre","image","movie","music","playlist","podcast","season","track","tvshow","url","video"],repeat:["off","one","all"]},number:{device_class:["temperature"]},sensor:{device_class:["apparent_power","aqi","battery","carbon_dioxide","carbon_monoxide","current","date","duration","energy","frequency","gas","humidity","illuminance","monetary","nitrogen_dioxide","nitrogen_monoxide","nitrous_oxide","ozone","ph","pm1","pm10","pm25","pm4","power_factor","power","pressure","reactive_power","signal_strength","sulphur_dioxide","temperature","timestamp","uptime","volatile_organic_compounds","volatile_organic_compounds_parts","voltage","volume_flow_rate"],state_class:["measurement","total","total_increasing"]},switch:{device_class:["outlet","switch"]},update:{device_class:["firmware"]},water_heater:{away_mode:["on","off"]}},l=(e,t,i=void 0)=>{const l=(0,s.t)(t),d=[];switch(d.push(...((e,t,i)=>{const s=[];switch(i||s.push(n.Hh,n.HV),!i&&t in r?s.push(...r[t]):i&&t in c&&i in c[t]&&s.push(...c[t][i]),t){case"device_tracker":case"person":i||s.push(...Object.entries(e.states).filter(([e,t])=>"zone"===(0,o.m)(e)&&"zone.home"!==e&&t.attributes.friendly_name).map(([e,t])=>t.attributes.friendly_name).sort((t,i)=>(0,a.xL)(t,i,e.locale.language)))}return s})(e,l,i)),l){case"climate":i?"fan_mode"===i?d.push(...t.attributes.fan_modes):"preset_mode"===i?d.push(...t.attributes.preset_modes):"swing_mode"===i?d.push(...t.attributes.swing_modes):"swing_horizontal_mode"===i&&d.push(...t.attributes.swing_horizontal_modes):d.push(...t.attributes.hvac_modes);break;case"event":"event_type"===i&&d.push(...t.attributes.event_types);break;case"fan":"preset_mode"===i&&d.push(...t.attributes.preset_modes);break;case"humidifier":"mode"===i&&d.push(...t.attributes.available_modes);break;case"input_select":case"select":i||d.push(...t.attributes.options);break;case"light":"effect"===i&&t.attributes.effect_list?d.push(...t.attributes.effect_list):"color_mode"===i&&t.attributes.supported_color_modes&&d.push(...t.attributes.supported_color_modes);break;case"media_player":"sound_mode"===i?d.push(...t.attributes.sound_mode_list):"source"===i&&d.push(...t.attributes.source_list);break;case"remote":"current_activity"===i&&d.push(...t.attributes.activity_list);break;case"sensor":i||"enum"!==t.attributes.device_class||d.push(...t.attributes.options);break;case"vacuum":"fan_speed"===i&&d.push(...t.attributes.fan_speed_list);break;case"water_heater":i&&"operation_mode"!==i||d.push(...t.attributes.operation_list)}return[...new Set(d)]}},90085:function(e,t,i){i.d(t,{_:function(){return o}});var n=i(63533),a=i(45291);const o=()=>(0,n.YP)((0,n.Yj)(),"custom element type",a.c8)},58548:function(e,t,i){i.d(t,{A:function(){return a}});i(16280),i(27495),i(25440);const n=e=>{const t=parseFloat(e);if(isNaN(t))throw new Error(`${e} is not a number`);return t};function a(e){if(!e)return null;try{if(e.endsWith("%"))return{w:100,h:n(e.slice(0,-1))};const t=e.replace(":","x").split("x");return 0===t.length?null:1===t.length?{w:n(t[0]),h:1}:{w:n(t[0]),h:n(t[1])}}catch(t){}return null}},37532:function(e,t,i){i.a(e,async function(e,t){try{i(44114),i(26910),i(18111),i(20116),i(62953);var n=i(40445),a=i(5124),o=i(67576),s=i(22786),r=i(1087),c=i(52220),l=i(38508),d=e([l]);l=(d.then?(await d)():d)[0];let h,u,p,g=e=>e;const _="default",f=[{name:"primary",weight:1}];class m extends a.WF{render(){var e,t,i,n,o;return(0,a.qy)(h||(h=g` <ha-generic-picker .label="${0}" .placeholder="${0}" .helper="${0}" .value="${0}" .valueRenderer="${0}" .getItems="${0}" .searchKeys="${0}" .disabled="${0}" .required="${0}" @value-changed="${0}"></ha-generic-picker> `),null!==(e=null!==(t=this.label)&&void 0!==t?t:null===(i=this.hass)||void 0===i?void 0:i.localize("ui.components.theme-picker.theme"))&&void 0!==e?e:"Theme",null!==(n=this.noThemeLabel)&&void 0!==n?n:null===(o=this.hass)||void 0===o?void 0:o.localize("ui.components.theme-picker.no_theme"),this.helper,this.value,this._valueRenderer,this._getItems,f,this.disabled,this.required,this._changed)}_changed(e){e.stopPropagation(),this.value=e.detail.value,(0,r.r)(this,"value-changed",{value:this.value})}constructor(...e){super(...e),this.includeDefault=!1,this.disabled=!1,this.required=!1,this._getThemeOptions=(0,s.A)((e,t,i)=>{const n=[];i&&n.push({id:_,primary:"ioBroker"});const a=Object.keys(e).sort((e,i)=>(0,c.SH)(e,i,t));for(const o of a)n.push({id:o,primary:o});return n}),this._getItems=()=>{var e,t;return this._getThemeOptions((null===(e=this.hass)||void 0===e?void 0:e.themes.themes)||{},(null===(t=this.hass)||void 0===t?void 0:t.locale.language)||"en",this.includeDefault)},this._valueRenderer=e=>{var t,i;return(0,a.qy)(u||(u=g`<span slot="headline">${0}</span>`),null!==(t=null===(i=this._getItems().find(t=>t.id===e))||void 0===i?void 0:i.primary)&&void 0!==t?t:e)}}}m.styles=(0,a.AH)(p||(p=g`ha-generic-picker{width:100%;display:block}`)),(0,n.Cg)([(0,o.MZ)()],m.prototype,"value",void 0),(0,n.Cg)([(0,o.MZ)()],m.prototype,"label",void 0),(0,n.Cg)([(0,o.MZ)()],m.prototype,"helper",void 0),(0,n.Cg)([(0,o.MZ)({attribute:"include-default",type:Boolean})],m.prototype,"includeDefault",void 0),(0,n.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,n.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],m.prototype,"disabled",void 0),(0,n.Cg)([(0,o.MZ)({type:Boolean})],m.prototype,"required",void 0),(0,n.Cg)([(0,o.MZ)({attribute:"no-theme-label"})],m.prototype,"noThemeLabel",void 0),m=(0,n.Cg)([(0,o.EM)("ha-theme-picker")],m),t()}catch(h){t(h)}})},17022:function(e,t,i){i.d(t,{A1:function(){return n},CY:function(){return s},Fn:function(){return a},Jz:function(){return c},St:function(){return r},VA:function(){return d},WI:function(){return h},iY:function(){return l},xw:function(){return o}});i(16280),i(3362);const n=(e,t)=>e.callWS({type:"media_source/resolve_media",media_content_id:t}),a=(e,t)=>e.callWS({type:"media_source/browse_media",media_content_id:t}),o="__MANUAL_ENTRY__",s=e=>e.startsWith(o),r=e=>e.startsWith("media-source://"),c=e=>e.startsWith("media-source://media_source"),l=e=>e.startsWith("media-source://image_upload"),d=async(e,t,i)=>{const n=new FormData;n.append("media_content_id",t),n.append("file",i);const a=await e.fetchWithAuth("/api/media_source/local_source/upload",{method:"POST",body:n});if(413===a.status)throw new Error(`Uploaded file is too large (${i.name})`);if(200!==a.status)throw new Error("Unknown error");return a.json()},h=async(e,t)=>e.callWS({type:"media_source/local_source/remove",media_content_id:t})},59927:function(e,t,i){i.a(e,async function(e,n){try{i.r(t),i.d(t,{HuiEntitiesCardEditor:function(){return D}});i(62953);var a=i(40445),o=i(5124),s=i(67576),r=i(22786),c=i(63533),l=i(1087),d=i(90085),h=(i(76776),i(6),i(47680),i(59646)),u=i(37532),p=i(91485),g=i(45291),_=i(97735),f=i(20939),m=i(9169),v=i(30345),y=i(29599),b=i(22357),w=i(81287),k=i(88170),$=i(91408),q=i(84698),C=i(55904),j=i(20507),x=i(7382),E=e([h,u,p,y,b,w,_]);[h,u,p,y,b,w,_]=E.then?(await E)():E;let z,Y,L,M=e=>e;const V=(0,c.Ik)({type:(0,c.eu)("button"),entity:(0,c.lq)((0,c.Yj)()),name:(0,c.lq)((0,c.Yj)()),icon:(0,c.lq)((0,c.Yj)()),action_name:(0,c.lq)((0,c.Yj)()),tap_action:$.kn,hold_action:(0,c.lq)($.kn),double_tap_action:(0,c.lq)($.kn)}),H=(0,c.Ik)({type:(0,c.eu)("cast"),view:(0,c.lq)((0,c.KC)([(0,c.Yj)(),(0,c.ai)()])),dashboard:(0,c.lq)((0,c.Yj)()),name:(0,c.lq)((0,c.Yj)()),icon:(0,c.lq)((0,c.Yj)()),hide_if_unavailable:(0,c.lq)((0,c.zM)())}),O=(0,c.Ik)({type:(0,c.vP)(["call-service","perform-action"]),name:(0,c.Yj)(),service:(0,c.lq)((0,c.Yj)()),action:(0,c.lq)((0,c.Yj)()),icon:(0,c.lq)((0,c.Yj)()),action_name:(0,c.lq)((0,c.Yj)()),service_data:(0,c.lq)((0,c.bz)()),data:(0,c.lq)((0,c.bz)())}),I=(0,c.Ik)({type:(0,c.eu)("conditional"),row:(0,c.bz)(),conditions:(0,c.YO)((0,c.bz)())}),Z=(0,c.Ik)({type:(0,c.eu)("divider"),style:(0,c.lq)((0,c.bz)())}),W=(0,c.Ik)({type:(0,c.eu)("section"),label:(0,c.lq)((0,c.Yj)())}),A=(0,c.Ik)({type:(0,c.eu)("weblink"),url:(0,c.Yj)(),name:(0,c.lq)((0,c.Yj)()),icon:(0,c.lq)((0,c.Yj)())}),P=(0,c.Ik)({type:(0,c.eu)("buttons"),entities:(0,c.YO)(C.J)}),S=(0,c.Ik)({type:(0,c.eu)("attribute"),entity:(0,c.Yj)(),attribute:(0,c.Yj)(),prefix:(0,c.lq)((0,c.Yj)()),suffix:(0,c.lq)((0,c.Yj)()),name:(0,c.lq)((0,c.Yj)()),icon:(0,c.lq)((0,c.Yj)()),format:(0,c.lq)((0,c.vP)(m.j))}),T=(0,c.Ik)({type:(0,c.eu)("text"),name:(0,c.Yj)(),text:(0,c.Yj)(),icon:(0,c.lq)((0,c.Yj)())}),K=(0,c.NW)({type:(0,d._)()}),R=(0,c.OR)(e=>{if(e&&"object"==typeof e&&"type"in e){if((0,g.c8)(e.type))return K;switch(e.type){case"attribute":return S;case"button":return V;case"buttons":return P;case"perform-action":case"call-service":return O;case"cast":return H;case"conditional":return I;case"divider":return Z;case"section":return W;case"text":return T;case"weblink":return A}}return j.l}),B=(0,c.kp)(q.H,(0,c.Ik)({title:(0,c.lq)((0,c.KC)([(0,c.Yj)(),(0,c.zM)()])),entity:(0,c.lq)((0,c.Yj)()),theme:(0,c.lq)((0,c.Yj)()),icon:(0,c.lq)((0,c.Yj)()),show_header_toggle:(0,c.lq)((0,c.zM)()),state_color:(0,c.lq)((0,c.zM)()),entities:(0,c.YO)(R),header:(0,c.lq)(v.zb),footer:(0,c.lq)(v.zb)}));class D extends o.WF{setConfig(e){(0,c.vA)(e,B),this._config=e,this._configEntities=(0,k._)(e.entities)}get _title(){return this._config.title||""}get _theme(){return this._config.theme||""}render(){return this.hass&&this._config?this._subElementEditorConfig?(0,o.qy)(z||(z=M` <hui-sub-element-editor .hass="${0}" .config="${0}" @go-back="${0}" @config-changed="${0}"> </hui-sub-element-editor> `),this.hass,this._subElementEditorConfig,this._goBack,this._handleSubElementChanged):(0,o.qy)(Y||(Y=M` <div class="card-config"> <ha-input .label="${0} (${0})" .value="${0}" .configValue="${0}" @input="${0}"></ha-input> <ha-theme-picker .hass="${0}" .value="${0}" .label="${0}" .configValue="${0}" @value-changed="${0}"></ha-theme-picker> <div class="side-by-side"> <ha-formfield .label="${0}"> <ha-switch .checked="${0}" .configValue="${0}" @change="${0}"></ha-switch> </ha-formfield> <ha-formfield .label="${0}"> <ha-switch .checked="${0}" .configValue="${0}" @change="${0}"></ha-switch> </ha-formfield> </div> <hui-header-footer-editor .hass="${0}" .configValue="${0}" .config="${0}" @value-changed="${0}" @edit-detail-element="${0}"></hui-header-footer-editor> <hui-header-footer-editor .hass="${0}" .configValue="${0}" .config="${0}" @value-changed="${0}" @edit-detail-element="${0}"></hui-header-footer-editor> </div> <hui-entities-card-row-editor .hass="${0}" .entities="${0}" @entities-changed="${0}" @edit-detail-element="${0}"></hui-entities-card-row-editor> `),this.hass.localize("ui.panel.lovelace.editor.card.generic.title"),this.hass.localize("ui.panel.lovelace.editor.card.config.optional"),this._title,"title",this._valueChanged,this.hass,this._theme,`${this.hass.localize("ui.panel.lovelace.editor.card.generic.theme")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`,"theme",this._valueChanged,this.hass.localize("ui.panel.lovelace.editor.card.entities.show_header_toggle"),this._showHeaderToggle(this._config),"show_header_toggle",this._valueChanged,this.hass.localize("ui.panel.lovelace.editor.card.generic.state_color"),this._config.state_color,"state_color",this._valueChanged,this.hass,"header",this._config.header,this._valueChanged,this._editDetailElement,this.hass,"footer",this._config.footer,this._valueChanged,this._editDetailElement,this.hass,this._configEntities,this._valueChanged,this._editDetailElement):o.s6}_valueChanged(e){var t;if(e.stopPropagation(),!this._config||!this.hass)return;const i=e.target,n=i.configValue||(null===(t=this._subElementEditorConfig)||void 0===t?void 0:t.type),a=void 0!==i.checked?i.checked:i.value||e.detail.config||e.detail.value;if(!("title"===n&&i.value===this._title||"theme"===n&&i.value===this._theme)){if("row"===n||e.detail&&e.detail.entities){const t=e.detail.entities||this._configEntities.concat();"row"===n&&(a?t[this._subElementEditorConfig.index]=a:(t.splice(this._subElementEditorConfig.index,1),this._goBack()),this._subElementEditorConfig.elementConfig=a),this._config=Object.assign(Object.assign({},this._config),{},{entities:t}),this._configEntities=(0,k._)(this._config.entities)}else n&&(""===a?(this._config=Object.assign({},this._config),delete this._config[n]):this._config=Object.assign(Object.assign({},this._config),{},{[n]:a}));(0,l.r)(this,"config-changed",{config:this._config})}}_handleSubElementChanged(e){var t;if(e.stopPropagation(),!this._config||!this.hass)return;const i=null===(t=this._subElementEditorConfig)||void 0===t?void 0:t.type,n=e.detail.config;if("row"===i){const e=this._configEntities.concat();n?e[this._subElementEditorConfig.index]=n:(e.splice(this._subElementEditorConfig.index,1),this._goBack()),this._config=Object.assign(Object.assign({},this._config),{},{entities:e}),this._configEntities=(0,k._)(this._config.entities)}else i&&(""===n?(this._config=Object.assign({},this._config),delete this._config[i]):this._config=Object.assign(Object.assign({},this._config),{},{[i]:n}));this._subElementEditorConfig=Object.assign(Object.assign({},this._subElementEditorConfig),{},{elementConfig:n}),(0,l.r)(this,"config-changed",{config:this._config})}_editDetailElement(e){this._subElementEditorConfig=e.detail.subElementConfig}_goBack(){this._subElementEditorConfig=void 0}static get styles(){return[x.U,(0,o.AH)(L||(L=M`.edit-entity-row-header{display:flex;justify-content:space-between;align-items:center;font-size:var(--ha-font-size-l)}hui-header-footer-editor{padding-top:var(--ha-space-1)}ha-input{--ha-input-padding-bottom:var(--ha-space-4)}`))]}constructor(...e){super(...e),this._showHeaderToggle=(0,r.A)(e=>void 0!==e.show_header_toggle?e.show_header_toggle:(0,_.y)(e,(0,f.L)(e.entities)))}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],D.prototype,"hass",void 0),(0,a.Cg)([(0,s.wk)()],D.prototype,"_config",void 0),(0,a.Cg)([(0,s.wk)()],D.prototype,"_configEntities",void 0),(0,a.Cg)([(0,s.wk)()],D.prototype,"_subElementEditorConfig",void 0),D=(0,a.Cg)([(0,s.EM)("hui-entities-card-editor")],D),n()}catch(z){n(z)}})},29599:function(e,t,i){i.a(e,async function(e,t){try{var n=i(40445),a=i(5124),o=i(67576),s=i(1087),r=i(26300),c=i(9693),l=e([r]);r=(l.then?(await l)():l)[0];let d,h,u,p,g=e=>e;const _="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",f="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",m="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class v extends a.WF{render(){var e,t,i;return(0,a.qy)(d||(d=g` <div> <span> ${0}: ${0} </span> </div> <div> ${0} </div> `),this.hass.localize(`ui.panel.lovelace.editor.header-footer.${this.configValue}`),null!==(e=this.config)&&void 0!==e&&e.type?this.hass.localize(`ui.panel.lovelace.editor.header-footer.types.${null===(t=this.config)||void 0===t?void 0:t.type}.name`):this.hass.localize("ui.panel.lovelace.editor.common.none"),null!==(i=this.config)&&void 0!==i&&i.type?(0,a.qy)(u||(u=g` <ha-icon-button .label="${0}" .path="${0}" class="remove-icon" @click="${0}"></ha-icon-button> <ha-icon-button .label="${0}" .path="${0}" class="edit-icon" @click="${0}"></ha-icon-button> `),this.hass.localize("ui.panel.lovelace.editor.common.clear"),_,this._delete,this.hass.localize("ui.panel.lovelace.editor.common.edit"),f,this._edit):(0,a.qy)(h||(h=g` <ha-icon-button .label="${0}" .path="${0}" class="add-icon" @click="${0}"></ha-icon-button> `),this.hass.localize("ui.panel.lovelace.editor.common.add"),m,this._add))}_edit(){(0,s.r)(this,"edit-detail-element",{subElementConfig:{elementConfig:this.config,type:this.configValue}})}_add(){(0,c.S)(this,{pickHeaderFooter:e=>this._elementPicked(e),type:this.configValue})}_elementPicked(e){(0,s.r)(this,"value-changed",{value:e}),(0,s.r)(this,"edit-detail-element",{subElementConfig:{elementConfig:e,type:this.configValue}})}_delete(){(0,s.r)(this,"value-changed",{value:""})}}v.styles=(0,a.AH)(p||(p=g`:host{font-size:var(--ha-font-size-l);display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;padding-bottom:12px}:host>div{display:flex;align-items:center}.header-footer-icon,ha-icon-button{--ha-icon-button-size:36px;color:var(--secondary-text-color)}.header-footer-icon{padding-right:8px;padding-inline-end:8px;padding-inline-start:initial}`)),(0,n.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"config",void 0),(0,n.Cg)([(0,o.MZ)({attribute:!1})],v.prototype,"configValue",void 0),v=(0,n.Cg)([(0,o.EM)("hui-header-footer-editor")],v),t()}catch(d){t(d)}})},9693:function(e,t,i){i.d(t,{S:function(){return o}});i(3362),i(62953);var n=i(1087);const a=()=>i.e(25897).then(i.bind(i,59152)),o=(e,t)=>{(0,n.r)(e,"show-dialog",{dialogTag:"hui-dialog-create-headerfooter",dialogImport:a,dialogParams:t})}},22357:function(e,t,i){i.a(e,async function(e,t){try{i(3362),i(88454),i(29452),i(62953);var n=i(40445),a=i(5124),o=i(67576),s=i(75751),r=i(1087),c=i(82474),l=i(26300),d=(i(85938),i(67094),e([c,l]));[c,l]=d.then?(await d)():d;let h,u,p,g,_,f=e=>e;const m="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",v="M21 11H3V9H21V11M21 13H3V15H21V13Z",y="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z";class b extends a.WF{_getKey(e){return this._entityKeys.has(e)||this._entityKeys.set(e,Math.random().toString()),this._entityKeys.get(e)}render(){return this.entities&&this.hass?(0,a.qy)(h||(h=f` <h3> ${0} </h3> <ha-sortable handle-selector=".handle" @item-moved="${0}"> <div class="entities"> ${0} </div> </ha-sortable> <ha-entity-picker class="add-entity" .hass="${0}" @value-changed="${0}" add-button></ha-entity-picker> `),this.label||`${this.hass.localize("ui.panel.lovelace.editor.card.generic.entities")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.required")})`,this._rowMoved,(0,s.u)(this.entities,e=>this._getKey(e),(e,t)=>(0,a.qy)(u||(u=f` <div class="entity"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> ${0} <ha-icon-button .label="${0}" .path="${0}" class="remove-icon" .index="${0}" @click="${0}"></ha-icon-button> <ha-icon-button .label="${0}" .path="${0}" class="edit-icon" .index="${0}" @click="${0}"></ha-icon-button> </div> `),v,e.type?(0,a.qy)(p||(p=f` <div class="special-row"> <div> <span> ${0} </span> <span class="secondary">${0}</span> </div> </div> `),this.hass.localize(`ui.panel.lovelace.editor.card.entities.entity_row.${e.type}`),this.hass.localize("ui.panel.lovelace.editor.card.entities.edit_special_row")):(0,a.qy)(g||(g=f` <ha-entity-picker hide-clear-icon .hass="${0}" .value="${0}" .index="${0}" @value-changed="${0}"></ha-entity-picker> `),this.hass,e.entity,t,this._valueChanged),this.hass.localize("ui.components.entity.entity-picker.clear"),m,t,this._removeRow,this.hass.localize("ui.components.entity.entity-picker.edit"),y,t,this._editRow)),this.hass,this._addEntity):a.s6}async _addEntity(e){const t=e.detail.value;if(""===t)return;const i=this.entities.concat({entity:t});e.target.value="",(0,r.r)(this,"entities-changed",{entities:i})}_rowMoved(e){e.stopPropagation();const{oldIndex:t,newIndex:i}=e.detail,n=this.entities.concat();n.splice(i,0,n.splice(t,1)[0]),(0,r.r)(this,"entities-changed",{entities:n})}_removeRow(e){const t=e.currentTarget.index,i=this.entities.concat();i.splice(t,1),(0,r.r)(this,"entities-changed",{entities:i})}_valueChanged(e){const t=e.detail.value,i=e.target.index,n=this.entities.concat();""===t||void 0===t?n.splice(i,1):n[i]=Object.assign(Object.assign({},n[i]),{},{entity:t}),(0,r.r)(this,"entities-changed",{entities:n})}_editRow(e){const t=e.currentTarget.index;(0,r.r)(this,"edit-detail-element",{subElementConfig:{index:t,type:"row",elementConfig:this.entities[t]}})}constructor(...e){super(...e),this._entityKeys=new WeakMap}}b.styles=(0,a.AH)(_||(_=f`ha-entity-picker{margin-top:var(--ha-space-2)}ha-sortable ha-entity-picker{margin-top:0}.add-entity{display:block;margin-bottom:var(--ha-space-1);margin-left:31px;margin-right:71px;margin-inline-start:31px;margin-inline-end:71px;direction:var(--direction)}.entity{display:flex;align-items:center;margin-top:var(--ha-space-2)}.entity .handle{padding-right:8px;cursor:move;cursor:grab;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.entity .handle>*{pointer-events:none}.entity ha-entity-picker{flex-grow:1;min-width:0}.special-row{height:60px;font-size:var(--ha-font-size-l);display:flex;align-items:center;justify-content:space-between;flex-grow:1}.special-row div{display:flex;flex-direction:column}.edit-icon,.remove-icon{--ha-icon-button-size:36px;color:var(--secondary-text-color)}.secondary{font-size:var(--ha-font-size-s);color:var(--secondary-text-color)}`)),(0,n.Cg)([(0,o.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,n.Cg)([(0,o.MZ)({attribute:!1})],b.prototype,"entities",void 0),(0,n.Cg)([(0,o.MZ)()],b.prototype,"label",void 0),b=(0,n.Cg)([(0,o.EM)("hui-entities-card-row-editor")],b),t()}catch(h){t(h)}})},55904:function(e,t,i){i.d(t,{J:function(){return o}});var n=i(63533),a=i(91408);const o=(0,n.Ik)({entity:(0,n.Yj)(),name:(0,n.lq)((0,n.Yj)()),icon:(0,n.lq)((0,n.Yj)()),image:(0,n.lq)((0,n.Yj)()),show_name:(0,n.lq)((0,n.zM)()),show_icon:(0,n.lq)((0,n.zM)()),tap_action:(0,n.lq)(a.kn),hold_action:(0,n.lq)(a.kn),double_tap_action:(0,n.lq)(a.kn)})},30345:function(e,t,i){i.d(t,{oe:function(){return c},zb:function(){return l}});var n=i(63533),a=i(91408),o=i(55904);const s=(0,n.Ik)({type:(0,n.Yj)(),image:(0,n.Yj)(),tap_action:(0,n.lq)(a.kn),hold_action:(0,n.lq)(a.kn),double_tap_action:(0,n.lq)(a.kn),alt_text:(0,n.lq)((0,n.Yj)())}),r=(0,n.Ik)({type:(0,n.Yj)(),entities:(0,n.YO)(o.J)}),c=(0,n.Ik)({type:(0,n.Yj)(),entity:(0,n.Yj)(),detail:(0,n.lq)((0,n.ai)()),hours_to_show:(0,n.lq)((0,n.ai)())}),l=(0,n.OR)(e=>{if(e&&"object"==typeof e&&"type"in e)switch(e.type){case"buttons":return r;case"graph":return c;case"picture":return s}return(0,n.KC)([r,c,s])})}}]);