function t(t,e,a,o){var i,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,a):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,a,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(r=(n<3?i(r):n>3?i(e,a,r):i(e,a))||r);return n>3&&r&&Object.defineProperty(e,a,r),r}const e=window,a=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),i=new WeakMap;class n{constructor(t,e,a){if(this._$cssResult$=!0,a!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(a&&void 0===t){const a=void 0!==e&&1===e.length;a&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),a&&i.set(e,t))}return t}toString(){return this.cssText}}const r=(t,...e)=>{const a=1===t.length?t[0]:e.reduce(((e,a,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(a)+t[o+1]),t[0]);return new n(a,t,o)},s=a?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const a of t.cssRules)e+=a.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,o))(e)})(t):t;var l;const c=window,u=c.trustedTypes,_=u?u.emptyScript:"",d=c.reactiveElementPolyfillSupport,h={toAttribute(t,e){switch(e){case Boolean:t=t?_:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let a=t;switch(e){case Boolean:a=null!==t;break;case Number:a=null===t?null:Number(t);break;case Object:case Array:try{a=JSON.parse(t)}catch(t){a=null}}return a}},m=(t,e)=>e!==t&&(e==e||t==t),p={attribute:!0,type:String,converter:h,reflect:!1,hasChanged:m};class g extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,a)=>{const o=this._$Ep(a,e);void 0!==o&&(this._$Ev.set(o,a),t.push(o))})),t}static createProperty(t,e=p){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const a="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,a,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,a){return{get(){return this[e]},set(o){const i=this[t];this[e]=o,this.requestUpdate(t,i,a)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const a of e)this.createProperty(a,t[a])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const a=new Set(t.flat(1/0).reverse());for(const t of a)e.unshift(s(t))}else void 0!==t&&e.push(s(t));return e}static _$Ep(t,e){const a=e.attribute;return!1===a?void 0:"string"==typeof a?a:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,a;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(a=t.hostConnected)||void 0===a||a.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const o=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,o)=>{a?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((a=>{const o=document.createElement("style"),i=e.litNonce;void 0!==i&&o.setAttribute("nonce",i),o.textContent=a.cssText,t.appendChild(o)}))})(o,this.constructor.elementStyles),o}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,a){this._$AK(t,a)}_$EO(t,e,a=p){var o;const i=this.constructor._$Ep(t,a);if(void 0!==i&&!0===a.reflect){const n=(void 0!==(null===(o=a.converter)||void 0===o?void 0:o.toAttribute)?a.converter:h).toAttribute(e,a.type);this._$El=t,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$El=null}}_$AK(t,e){var a;const o=this.constructor,i=o._$Ev.get(t);if(void 0!==i&&this._$El!==i){const t=o.getPropertyOptions(i),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(a=t.converter)||void 0===a?void 0:a.fromAttribute)?t.converter:h;this._$El=i,this[i]=n.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,a){let o=!0;void 0!==t&&(((a=a||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===a.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,a))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const a=this._$AL;try{e=this.shouldUpdate(a),e?(this.willUpdate(a),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(a)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(a)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var v;g.finalized=!0,g.elementProperties=new Map,g.elementStyles=[],g.shadowRootOptions={mode:"open"},null==d||d({ReactiveElement:g}),(null!==(l=c.reactiveElementVersions)&&void 0!==l?l:c.reactiveElementVersions=[]).push("1.6.1");const f=window,b=f.trustedTypes,w=b?b.createPolicy("lit-html",{createHTML:t=>t}):void 0,y="$lit$",k=`lit$${(Math.random()+"").slice(9)}$`,$="?"+k,z=`<${$}>`,A=document,S=()=>A.createComment(""),j=t=>null===t||"object"!=typeof t&&"function"!=typeof t,x=Array.isArray,C="[ \t\n\f\r]",E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,P=/>/g,M=RegExp(`>|${C}(?:([^\\s"'>=/]+)(${C}*=${C}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,T=/"/g,N=/^(?:script|style|textarea|title)$/i,I=(t=>(e,...a)=>({_$litType$:t,strings:e,values:a}))(1),R=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),U=new WeakMap,H=A.createTreeWalker(A,129,null,!1);function D(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==w?w.createHTML(e):e}const Z=(t,e)=>{const a=t.length-1,o=[];let i,n=2===e?"":"",r=E;for(let e=0;e"===l[0]?(r=null!=i?i:E,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,s=l[1],r=void 0===l[3]?M:'"'===l[3]?T:V):r===T||r===V?r=M:r===O||r===P?r=E:(r=M,i=void 0);const _=r===M&&t[e+1].startsWith("/>")?" ":"";n+=r===E?a+z:c>=0?(o.push(s),a.slice(0,c)+y+a.slice(c)+k+_):a+k+(-2===c?(o.push(void 0),e):_)}return[D(t,n+(t[a]||"")+(2===e?"":"")),o]};class q{constructor({strings:t,_$litType$:e},a){let o;this.parts=[];let i=0,n=0;const r=t.length-1,s=this.parts,[l,c]=Z(t,e);if(this.el=q.createElement(l,a),H.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=H.nextNode())&&s.length0){o.textContent=b?b.emptyScript:"";for(let a=0;ax(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==L&&j(this._$AH)?this._$AA.nextSibling.data=t:this.$(A.createTextNode(t)),this._$AH=t}g(t){var e;const{values:a,_$litType$:o}=t,i="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=q.createElement(D(o.h,o.h[0]),this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.v(a);else{const t=new K(i,this),e=t.u(this.options);t.v(a),this.$(e),this._$AH=t}}_$AC(t){let e=U.get(t.strings);return void 0===e&&U.set(t.strings,e=new q(t)),e}T(t){x(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let a,o=0;for(const i of t)o===e.length?e.push(a=new W(this.k(S()),this.k(S()),this,this.options)):a=e[o],a._$AI(i),o++;o2||""!==a[0]||""!==a[1]?(this._$AH=Array(a.length-1).fill(new String),this.strings=a):this._$AH=L}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,a,o){const i=this.strings;let n=!1;if(void 0===i)t=B(this,t,e,0),n=!j(t)||t!==this._$AH&&t!==R,n&&(this._$AH=t);else{const o=t;let r,s;for(t=i[0],r=0;r{var o,i;const n=null!==(o=null==a?void 0:a.renderBefore)&&void 0!==o?o:e;let r=n._$litPart$;if(void 0===r){const t=null!==(i=null==a?void 0:a.renderBefore)&&void 0!==i?i:null;n._$litPart$=r=new W(e.insertBefore(S(),t),t,void 0,null!=a?a:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return R}}ot.finalized=!0,ot._$litElement$=!0,null===(et=globalThis.litElementHydrateSupport)||void 0===et||et.call(globalThis,{LitElement:ot});const it=globalThis.litElementPolyfillSupport;null==it||it({LitElement:ot}),(null!==(at=globalThis.litElementVersions)&&void 0!==at?at:globalThis.litElementVersions=[]).push("3.3.2");const nt=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:a,elements:o}=e;return{kind:a,elements:o,finisher(e){customElements.define(t,e)}}})(t,e),rt=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(a){a.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(a){a.createProperty(e.key,t)}};function st(t){return(e,a)=>void 0!==a?((t,e,a)=>{e.constructor.createProperty(a,t)})(t,e,a):rt(t,e)}function lt(t){return st({...t,state:!0})}var ct,ut,_t;null===(ct=window.HTMLSlotElement)||void 0===ct||ct.prototype.assignedElements,function(t){t.language="language",t.system="system",t.comma_decimal="comma_decimal",t.decimal_comma="decimal_comma",t.space_comma="space_comma",t.none="none"}(ut||(ut={})),function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}(_t||(_t={}));var dt=function(t,e,a,o){o=o||{},a=null==a?{}:a;var i=new Event(e,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});return i.detail=a,t.dispatchEvent(i),i};function ht(t,e,a,o){var i,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,a):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,a,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(r=(n<3?i(r):n>3?i(e,a,r):i(e,a))||r);return n>3&&r&&Object.defineProperty(e,a,r),r}class mt extends ot{constructor(){super(...arguments),this.template="",this.variables={},this.value=null,this.unsubscribePromise=null}connectedCallback(){super.connectedCallback(),this.hass?this.unsubscribePromise||this.template&&(this.unsubscribePromise=this.hass.connection.subscribeMessage((t=>{this.value=t.result}),{type:"render_template",template:this.template,variables:this.variables})):console.warn("hass object is not provided")}async disconnectedCallback(){if(super.disconnectedCallback(),this.unsubscribePromise)try{const t=await this.unsubscribePromise;return this.unsubscribePromise=null,t()}catch(t){if("not_found"!==t.code)throw t}}render(){var t;return null!==(t=this.value)&&void 0!==t?t:L}}ht([st()],mt.prototype,"hass",void 0),ht([st()],mt.prototype,"template",void 0),ht([st()],mt.prototype,"variables",void 0),ht([st()],mt.prototype,"value",void 0),ht([lt()],mt.prototype,"unsubscribePromise",void 0);var pt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function gt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vt=Array.isArray,ft="object"==typeof pt&&pt&&pt.Object===Object&&pt,bt="object"==typeof self&&self&&self.Object===Object&&self,wt=ft||bt||Function("return this")(),yt=wt.Symbol,kt=yt,$t=Object.prototype,zt=$t.hasOwnProperty,At=$t.toString,St=kt?kt.toStringTag:void 0;var jt=function(t){var e=zt.call(t,St),a=t[St];try{t[St]=void 0;var o=!0}catch(t){}var i=At.call(t);return o&&(e?t[St]=a:delete t[St]),i},xt=Object.prototype.toString;var Ct=jt,Et=function(t){return xt.call(t)},Ot=yt?yt.toStringTag:void 0;var Pt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Ot&&Ot in Object(t)?Ct(t):Et(t)};var Mt=Pt,Vt=function(t){return null!=t&&"object"==typeof t};var Tt=function(t){return"symbol"==typeof t||Vt(t)&&"[object Symbol]"==Mt(t)},Nt=vt,It=Tt,Rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lt=/^\w*$/;var Ut=function(t,e){if(Nt(t))return!1;var a=typeof t;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=t&&!It(t))||(Lt.test(t)||!Rt.test(t)||null!=e&&t in Object(e))};var Ht=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Dt=Pt,Zt=Ht;var qt,Bt=function(t){if(!Zt(t))return!1;var e=Dt(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Kt=wt["__core-js_shared__"],Wt=(qt=/[^.]+$/.exec(Kt&&Kt.keys&&Kt.keys.IE_PROTO||""))?"Symbol(src)_1."+qt:"";var Ft=function(t){return!!Wt&&Wt in t},Gt=Function.prototype.toString;var Jt=Bt,Yt=Ft,Xt=Ht,Qt=function(t){if(null!=t){try{return Gt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},te=/^\[object .+?Constructor\]$/,ee=Function.prototype,ae=Object.prototype,oe=ee.toString,ie=ae.hasOwnProperty,ne=RegExp("^"+oe.call(ie).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var re=function(t){return!(!Xt(t)||Yt(t))&&(Jt(t)?ne:te).test(Qt(t))},se=function(t,e){return null==t?void 0:t[e]};var le=function(t,e){var a=se(t,e);return re(a)?a:void 0},ce=le(Object,"create"),ue=ce;var _e=function(){this.__data__=ue?ue(null):{},this.size=0};var de=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},he=ce,me=Object.prototype.hasOwnProperty;var pe=function(t){var e=this.__data__;if(he){var a=e[t];return"__lodash_hash_undefined__"===a?void 0:a}return me.call(e,t)?e[t]:void 0},ge=ce,ve=Object.prototype.hasOwnProperty;var fe=ce;var be=_e,we=de,ye=pe,ke=function(t){var e=this.__data__;return ge?void 0!==e[t]:ve.call(e,t)},$e=function(t,e){var a=this.__data__;return this.size+=this.has(t)?0:1,a[t]=fe&&void 0===e?"__lodash_hash_undefined__":e,this};function ze(t){var e=-1,a=null==t?0:t.length;for(this.clear();++e-1},Re=function(t,e){var a=this.__data__,o=Me(a,t);return o<0?(++this.size,a.push([t,e])):a[o][1]=e,this};function Le(t){var e=-1,a=null==t?0:t.length;for(this.clear();++et.startsWith("vacuum")));return{entity:null!=a?a:""}}get entity(){return this.hass.states[this.config.entity]}get map(){return this.hass&&this.config.map?this.hass.states[this.config.map]:null}setConfig(t){this.config=function(t){var e,a,o,i,n,r,s,l,c,u;if(!t)throw new Error(Yn("error.invalid_config"));if(!t.entity)throw new Error(Yn("error.missing_entity"));const _=t.actions;return _&&Array.isArray(_)&&console.warn(Yn("warning.actions_array")),{entity:t.entity,map:null!==(e=t.map)&&void 0!==e?e:"",map_refresh:null!==(a=t.map_refresh)&&void 0!==a?a:5,image:null!==(o=t.image)&&void 0!==o?o:"default",show_name:null===(i=t.show_name)||void 0===i||i,show_status:null===(n=t.show_status)||void 0===n||n,show_toolbar:null===(r=t.show_toolbar)||void 0===r||r,compact_view:null!==(s=t.compact_view)&&void 0!==s&&s,stats:null!==(l=t.stats)&&void 0!==l?l:{},actions:null!==(c=t.actions)&&void 0!==c?c:{},shortcuts:null!==(u=t.shortcuts)&&void 0!==u?u:[]}}(t)}getCardSize(){return this.config.compact_view?3:8}shouldUpdate(t){return function(t,e,a){if(e.has("config")||a)return!0;if(t.config.entity){var o=e.get("hass");return!o||o.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}(this,t,!1)}updated(t){t.get("hass")&&t.get("hass").states[this.config.entity].state!==this.hass.states[this.config.entity].state&&(this.requestInProgress=!1)}connectedCallback(){super.connectedCallback(),!this.config.compact_view&&this.map&&(this.requestUpdate(),this.thumbUpdater=setInterval((()=>this.requestUpdate()),1e3*this.config.map_refresh))}disconnectedCallback(){super.disconnectedCallback(),this.map&&this.thumbUpdater&&clearInterval(this.thumbUpdater)}handleMore(t=this.entity.entity_id){dt(this,"hass-more-info",{entityId:t},{bubbles:!1,composed:!0})}callService(t){const{service:e,service_data:a,target:o}=t,[i,n]=e.split(".");this.hass.callService(i,n,a,o)}callVacuumService(t,e={request:!0},a={}){this.hass.callService("vacuum",t,Object.assign({entity_id:this.config.entity},a)),e.request&&(this.requestInProgress=!0,this.requestUpdate())}handleSpeed(t){const e=t.target.getAttribute("value");this.callVacuumService("set_fan_speed",{request:!1},{fan_speed:e})}handleVacuumAction(t,e={request:!0}){return()=>{if(!this.config.actions[t])return this.callVacuumService(e.defaultService||t,e);this.callService(this.config.actions[t])}}getAttributes(t){var e;const{status:a,state:o}=t.attributes;return Object.assign(Object.assign({},t.attributes),{status:null!==(e=null!=a?a:o)&&void 0!==e?e:t.state})}renderSource(){const{fan_speed:t,fan_speed_list:e}=this.getAttributes(this.entity);if(!e||!t)return L;const a=e.indexOf(t);return I`
${Yn(`source.${t.toLowerCase()}`)||t}
${e.map(((t,e)=>I`${Yn(`source.${t.toLowerCase()}`)||t}`))}
`}renderBattery(){const{battery_level:t,battery_icon:e}=this.getAttributes(this.entity);return I`
${t}%
`}renderMapOrImage(t){if(this.config.compact_view)return L;if(this.map)return this.map&&this.map.attributes.entity_picture?I``:L;const e="default"===this.config.image?"data:image/svg+xml,%3csvg width='490' height='490' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M490 245c0 135.31-109.69 245-245 245S0 380.31 0 245c0-3.013.0543891-6.013.162239-9H5l5 3v-12l-8.84919-5.899C13.1643 97.0064 117.754 0 245 0c127.089 0 231.578 96.7672 243.804 220.641L480 227v12.5l5-4h4.819c.12 3.152.181 6.319.181 9.5Z' fill='white'/%3e%3cpath d='M411.749 119c-6.307-8.348-13.27-16.258-20.851-23.6492C351.81 57.243 299.364 35.941 244.774 36.0001c-54.59.0591-106.99 21.4746-145.9954 59.667C59.7735 133.86 37.2596 185.797 36.0512 240.374l2.0895.046c.918-41.46 14.2556-81.382 37.8593-114.798V126h116v-2H77.1576c.7253-1.006 1.46-2.006 2.204-3H192v-2H80.8779c5.8988-7.683 12.3626-14.985 19.3631-21.8395 38.615-37.8105 90.491-59.0119 144.535-59.0704 54.044-.0585 105.966 21.0305 144.663 58.7572 7.123 6.9447 13.694 14.3517 19.683 22.1527H299v2h111.638c.744.994 1.479 1.994 2.204 3H299v2h115.266c23.35 33.213 36.583 72.821 37.583 113.972l2.089-.051c-1.066-43.848-15.882-85.962-41.938-120.589V119h-.251Z' fill='%23AAA'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M300 122.5c0 30.1-24.624 54.5-55 54.5s-55-24.4-55-54.5c0-30.0995 24.624-54.5 55-54.5s55 24.4005 55 54.5Zm-4 0c0 27.856-22.799 50.5-51 50.5s-51-22.644-51-50.5S216.799 72 245 72s51 22.644 51 50.5Z' fill='%23666'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M1.12741 221.523C6.9567 160.97 35.1055 104.75 80.0964 63.8045 125.087 22.8589 183.702.115675 244.536.00044016 305.369-.114809 364.07 22.4061 409.216 63.1811c44.985 40.6299 73.305 96.4879 79.5 156.7719l.011.001c-.002.013-.004.025-.007.038.021.202.042.405.062.607l-.279.028c-.145.286-.312.483-.382.565l-.003.005c-.185.218-.402.426-.611.612-.425.377-.994.817-1.651 1.294-1.325.963-3.171 2.194-5.341 3.588-.17.109-.341.219-.515.33v12.215l.249-.174c1.54-1.073 2.823-1.981 3.736-2.644.39-.283.703-.515.936-.693l-.007-.183.254-.01c.048-.038.083-.067.106-.087l.008-.007-.01.01c-.01.009-.033.032-.063.066l-.015.017 4.616-.182c1.298 32.938-4.063 65.799-15.764 96.616-11.7 30.816-29.499 58.955-52.331 82.731-22.832 23.776-50.226 42.7-80.544 55.64-30.317 12.939-62.934 19.627-95.898 19.664-32.963.037-65.594-6.579-95.941-19.45-30.346-12.872-57.783-31.735-80.6677-55.46-22.8846-23.725-40.7463-51.824-52.5157-82.614-11.76935-30.791-17.20429-63.64-15.979377-96.58l3.830807.142V236c.18555 0 .35898.025.50489.057l.56091.021-.00581.158c.13048.053.26118.112.38589.171.35305.167.78483.397 1.26649.667.87404.489 1.99915 1.158 3.2876 1.949v-12.13l-.4815-.302c-2.17716-1.367-4.02092-2.536-5.35246-3.398-.66426-.431-1.21155-.792-1.61262-1.066-.19905-.136-.37589-.261-.51834-.366l-.01222-.009c-.04061-.03-.11781-.087-.20795-.163l-.6875-.066ZM464.644 236.475c3.564-2.147 7.127-4.312 10.356-6.313v12.528c-1.909 1.31-3.945 2.699-5.987 4.086-4.093 2.779-8.206 5.546-11.376 7.648-1.586 1.052-2.93 1.933-3.915 2.566-.474.304-.857.546-1.14.719l-.19-.011-.007.131c-.063.037-.107.062-.135.079-.03.017-.042.025-.042.025l.024-.009c.01-.004.023-.01.039-.016l.095.241c-3.217 52.86-26.453 102.516-64.989 138.858-38.646 36.444-89.759 56.743-142.878 56.743-53.12 0-104.232-20.3-142.878-56.745-38.6453-36.445-61.9029-86.281-65.0136-139.31l-.2108.013c-.0549-.17-.1194-.3-.1616-.378-.0859-.16-.1788-.29-.2489-.38-.1401-.181-.2992-.346-.4386-.482-.2858-.279-.6601-.598-1.0796-.936-.8488-.684-2.029-1.563-3.413-2.556-2.7761-1.991-6.4661-4.507-10.1873-6.974-1.9862-1.317-3.9866-2.622-5.8676-3.83v-12.157c3.2173 2.001 6.7542 4.19 10.2783 6.365 5.686 3.509 11.3427 6.985 15.5776 9.583 2.1175 1.299 3.8798 2.379 5.1126 3.134l1.0774.66c1.0989 51.017 21.909 99.675 58.1301 135.725 36.902 36.729 86.816 57.401 138.881 57.518 52.066.116 102.072-20.331 139.139-56.895 36.507-36.012 57.554-84.787 58.75-135.992.352-.224.817-.513 1.385-.861 1.325-.813 3.172-1.923 5.371-3.238 1.287-.77 2.693-1.609 4.183-2.498l.097-.058c3.574-2.133 7.624-4.55 11.662-6.983ZM6.22995 219.764l.11131.072c1.3071.847 3.13156 2.004 5.30424 3.368 4.343 2.727 10.0507 6.265 15.7336 9.772 5.6819 3.507 11.3354 6.98 15.5686 9.578 2.1165 1.298 3.8778 2.377 5.11 3.132l1.9049 1.166.9921-.007c.3546 51.024 20.8428 99.843 57.0073 135.837 36.165 35.995 85.08 56.253 136.104 56.367 51.025.115 100.03-19.924 136.356-55.756 36.325-35.832 57.032-84.559 57.615-135.58l.585.006-.071-.066c.19-.204.434-.374.522-.435l.012-.008c.144-.101.323-.22.524-.35.406-.262.96-.607 1.631-1.018 1.346-.826 3.21-1.946 5.409-3.261 1.321-.79 2.764-1.651 4.292-2.563 3.571-2.131 7.608-4.54 11.639-6.969 5.757-3.469 11.476-6.963 15.773-9.723 2.152-1.384 3.921-2.565 5.152-3.459.053-.038.104-.076.154-.113l.102-.075c-6.233-58.782-33.937-113.219-77.829-152.8616C361.689 26.858 304.162 4.78749 244.545 4.90042 184.928 5.01336 127.486 27.3017 83.3945 67.4284 39.856 107.052 12.4116 161.271 6.22995 219.764Zm2.09908 22.928c-1.35577-.837-2.51273-1.53-3.38991-2.026-.55505 30.74 4.79901 61.315 15.78648 90.06 11.534 30.175 29.0385 57.712 51.4654 80.963 22.427 23.25 49.315 41.736 79.055 54.35 29.739 12.614 61.718 19.097 94.022 19.061 32.304-.036 64.269-6.591 93.98-19.271 29.711-12.681 56.558-31.226 78.933-54.527 22.375-23.3 39.818-50.876 51.284-81.077 10.871-28.632 16.159-59.064 15.594-89.655-.734.522-1.584 1.119-2.522 1.773-3.095 2.159-7.176 4.958-11.277 7.742-4.101 2.785-8.227 5.56-11.412 7.673-1.284.851-2.419 1.597-3.34 2.194-3.637 53.361-27.268 103.418-66.216 140.147C350.858 437.287 298.702 458 244.498 458c-54.204 0-106.359-20.714-145.7927-57.903-39.1679-36.938-62.8452-87.356-66.2735-141.057-.1301-.112-.2876-.243-.4742-.394-.7611-.613-1.8697-1.441-3.2341-2.419-2.7209-1.952-6.3663-4.439-10.0659-6.891-3.6986-2.452-7.4329-4.857-10.32857-6.644Z' fill='%23666'/%3e%3crect x='233' y='365' width='24' height='53' rx='12' stroke='%23AAA' stroke-width='2'/%3e%3c/svg%3e":this.config.image;return I``}renderStats(t){const e=(this.config.stats[t]||this.config.stats.default||[]).map((({entity_id:t,attribute:e,value_template:a,unit:o,subtitle:i})=>{if(!t&&!e)return L;let n="";if(t&&e)n=Aa(this.hass.states[t].attributes,e);else if(e)n=Aa(this.entity.attributes,e);else{if(!t)return L;n=this.hass.states[t].state}const r=I``;return I`
${r} ${o}
${i}
`}));return e.length?I`
${e}
`:L}renderName(){const{friendly_name:t}=this.getAttributes(this.entity);return this.config.show_name?I`
${t}
`:L}renderStatus(){const{status:t}=this.getAttributes(this.entity),e=Yn(`status.${t.toLowerCase()}`)||t;return this.config.show_status?I`
${e}
`:L}renderToolbar(t){if(!this.config.show_toolbar)return L;switch(t){case"on":case"auto":case"spot":case"edge":case"single_room":case"cleaning":return I`
${Yn("common.pause")}${Yn("common.stop")}${Yn("common.return_to_base")}
`;case"paused":return I`
${Yn("common.continue")}${Yn("common.return_to_base")}
`;case"returning":return I`
${Yn("common.continue")}${Yn("common.pause")}
`;default:{const e=this.config.shortcuts.map((({name:t,service:e,icon:a,service_data:o,target:i})=>I``)),a=I``;return I`
${"idle"===t?a:""}
${e}
`}}}renderUnavailable(){return I`
`}render(){return this.entity?I`
${this.renderSource()} ${this.renderBattery()}
${this.renderMapOrImage(this.entity.state)}${this.renderStats(this.entity.state)}
${this.renderToolbar(this.entity.state)}
`:this.renderUnavailable()}};t([st({attribute:!1})],er.prototype,"hass",void 0),t([lt()],er.prototype,"config",void 0),t([lt()],er.prototype,"requestInProgress",void 0),t([lt()],er.prototype,"thumbUpdater",void 0),er=t([nt("vacuum-card")],er),window.customCards=window.customCards||[],window.customCards.push({preview:!0,type:"vacuum-card",name:Yn("common.name"),description:Yn("common.description")});var ar=r`.card-config{flex-direction:column;display:flex;gap:10px}.option{display:flex;align-items:center}.option ha-switch{margin-right:10px}.option ha-select,.option paper-input{width:100%}`;Xn(ar);let or=class extends ot{constructor(){super(...arguments),this.image=void 0,this.compact_view=!1,this.show_name=!0,this.show_status=!0,this.show_toolbar=!0}setConfig(t){this.config=t,this.config.entity||(this.config.entity=this.getEntitiesByType("vacuum")[0]||"",dt(this,"config-changed",{config:this.config}))}getEntitiesByType(t){return this.hass?Object.keys(this.hass.states).filter((e=>e.startsWith(t))):[]}render(){if(!this.hass)return L;const t=this.getEntitiesByType("vacuum"),e=[...this.getEntitiesByType("camera"),...this.getEntitiesByType("image")];return I`
${t.map((t=>I`${t}`))}
${e.map((t=>I`${t}`))}
${Yn("editor.compact_view")}
${Yn("editor.show_name")}
${Yn("editor.show_status")}
${Yn("editor.show_toolbar")}
${Yn("editor.code_only_note")}
`}valueChanged(t){if(!this.config||!this.hass||!t.target)return;const e=t.target;e.configValue&&this.config[e.configValue]!==(null==e?void 0:e.value)&&(e.configValue&&(""===e.value?delete this.config[e.configValue]:this.config=Object.assign(Object.assign({},this.config),{[e.configValue]:void 0!==e.checked?e.checked:e.value})),dt(this,"config-changed",{config:this.config}))}static get styles(){return ar}};t([st({attribute:!1})],or.prototype,"hass",void 0),t([lt()],or.prototype,"config",void 0),t([lt()],or.prototype,"image",void 0),t([lt()],or.prototype,"compact_view",void 0),t([lt()],or.prototype,"show_name",void 0),t([lt()],or.prototype,"show_status",void 0),t([lt()],or.prototype,"show_toolbar",void 0),or=t([nt("vacuum-card-editor")],or);var ir=Object.freeze({__proto__:null,get VacuumCardEditor(){return or}});export{er as VacuumCard};