UNPKG

iobroker.lovelace

Version:

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

1 lines 24.3 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[76696],{72487:function(t,e,i){i.a(t,async function(t,a){try{i.d(e,{CA:function(){return M},Mi:function(){return $},Pm:function(){return z},Wq:function(){return _},Yq:function(){return d},bl:function(){return A},c2:function(){return w},fr:function(){return p},gu:function(){return F},kz:function(){return u},m9:function(){return L},sl:function(){return g},ur:function(){return Z},zB:function(){return f}});i(18111),i(20116);var n=i(74487),o=i(22786),r=i(46927),c=i(8480),s=t([n,c]);[n,c]=s.then?(await s)():s;(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric",timeZone:(0,c.wj)(t.time_zone,e)}));const d=(t,e,i)=>l(e,i.time_zone).format(t),l=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",timeZone:(0,c.wj)(t.time_zone,e)})),u=(t,e,i)=>m(e,i.time_zone).format(t),m=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"short",day:"numeric",timeZone:(0,c.wj)(t.time_zone,e)})),f=(t,e,i)=>{var a,n,o,c;const s=h(e,i.time_zone);if(e.date_format===r.ow.language||e.date_format===r.ow.system)return s.format(t);const d=s.formatToParts(t),l=null===(a=d.find(t=>"literal"===t.type))||void 0===a?void 0:a.value,u=null===(n=d.find(t=>"day"===t.type))||void 0===n?void 0:n.value,m=null===(o=d.find(t=>"month"===t.type))||void 0===o?void 0:o.value,f=null===(c=d.find(t=>"year"===t.type))||void 0===c?void 0:c.value,g=d[d.length-1];let b="literal"===(null==g?void 0:g.type)?null==g?void 0:g.value:"";"bg"===e.language&&e.date_format===r.ow.YMD&&(b="");return{[r.ow.DMY]:`${u}${l}${m}${l}${f}${b}`,[r.ow.MDY]:`${m}${l}${u}${l}${f}${b}`,[r.ow.YMD]:`${f}${l}${m}${l}${u}${b}`}[e.date_format]},h=(0,o.A)((t,e)=>{const i=t.date_format===r.ow.system?void 0:t.language;return t.date_format===r.ow.language||(t.date_format,r.ow.system),new Intl.DateTimeFormat(i,{year:"numeric",month:"numeric",day:"numeric",timeZone:(0,c.wj)(t.time_zone,e)})}),g=(t,e,i)=>b(e,i.time_zone).format(t),b=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{day:"numeric",month:"short",timeZone:(0,c.wj)(t.time_zone,e)})),p=(t,e,i)=>v(e,i.time_zone).format(t),v=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric",timeZone:(0,c.wj)(t.time_zone,e)})),_=(t,e,i)=>y(e,i.time_zone).format(t),y=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",timeZone:(0,c.wj)(t.time_zone,e)})),w=(t,e,i)=>k(e,i.time_zone).format(t),k=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"short",timeZone:(0,c.wj)(t.time_zone,e)})),z=(t,e,i)=>C(e,i.time_zone).format(t),C=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",timeZone:(0,c.wj)(t.time_zone,e)})),M=(t,e,i)=>j(e,i.time_zone).format(t),j=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",timeZone:(0,c.wj)(t.time_zone,e)})),F=(t,e,i)=>I(e,i.time_zone).format(t),I=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",timeZone:(0,c.wj)(t.time_zone,e)})),$=(t,e,i)=>D(e,i.time_zone).format(t),D=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",month:"short",day:"numeric",timeZone:(0,c.wj)(t.time_zone,e)})),Z=(t,e,i)=>T(e,i.time_zone).format(t),T=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",month:"short",day:"numeric",year:"numeric",timeZone:(0,c.wj)(t.time_zone,e)})),A=(t,e,i)=>{const a=(0,c.wj)(e.time_zone,i.time_zone);return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:a}).format(t)},L=(t,e,i,a)=>`${A(t,i,a)}/${A(e,i,a)}`;a()}catch(d){a(d)}})},95747:function(t,e,i){i.a(t,async function(t,a){try{i.d(e,{CL:function(){return _},GH:function(){return k},Rl:function(){return f},ZS:function(){return p},aQ:function(){return g},r6:function(){return u},yg:function(){return y}});var n=i(74487),o=i(22786),r=i(72487),c=i(30162),s=i(8480),d=i(69543),l=t([n,s,r,c]);[n,s,r,c]=l.then?(await l)():l;const u=(t,e,i)=>m(e,i.time_zone).format(t),m=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:(0,d.J)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,d.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),f=t=>h().format(t),h=(0,o.A)(()=>new Intl.DateTimeFormat(void 0,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})),g=(t,e,i)=>b(e,i.time_zone).format(t),b=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"short",day:"numeric",hour:(0,d.J)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,d.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),p=(t,e,i)=>v(e,i.time_zone).format(t),v=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"short",day:"numeric",hour:(0,d.J)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,d.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),_=(t,e,i)=>(new Date).getFullYear()===t.getFullYear()?p(t,e,i):g(t,e,i),y=(t,e,i)=>w(e,i.time_zone).format(t),w=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:(0,d.J)(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,d.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),k=(t,e,i)=>`${(0,r.zB)(t,e,i)}, ${(0,c.fU)(t,e,i)}`;a()}catch(u){a(u)}})},30162:function(t,e,i){i.a(t,async function(t,a){try{i.d(e,{LW:function(){return g},Xs:function(){return f},fU:function(){return d},ie:function(){return u}});var n=i(74487),o=i(22786),r=i(8480),c=i(69543),s=t([n,r]);[n,r]=s.then?(await s)():s;const d=(t,e,i)=>l(e,i.time_zone).format(t),l=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,c.J)(t)?"h12":"h23",timeZone:(0,r.wj)(t.time_zone,e)})),u=(t,e,i)=>m(e,i.time_zone).format(t),m=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:(0,c.J)(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,c.J)(t)?"h12":"h23",timeZone:(0,r.wj)(t.time_zone,e)})),f=(t,e,i)=>h(e,i.time_zone).format(t),h=(0,o.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",hour:(0,c.J)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,c.J)(t)?"h12":"h23",timeZone:(0,r.wj)(t.time_zone,e)})),g=(t,e,i)=>b(e,i.time_zone).format(t),b=(0,o.A)((t,e)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,r.wj)(t.time_zone,e)}));a()}catch(d){a(d)}})},8480:function(t,e,i){i.a(t,async function(t,a){try{i.d(e,{fL:function(){return f},n2:function(){return h},wj:function(){return g}});var n,o,r,c=i(74487),s=i(29079),d=i(46927),l=t([c]);c=(l.then?(await l)():l)[0];const u=null===(n=Intl.DateTimeFormat)||void 0===n||null===(o=(r=n.call(Intl)).resolvedOptions)||void 0===o?void 0:o.call(r).timeZone,m=u&&("UTC"===u||"Etc/UTC"===u||u in s)?u:void 0,f=14881==i.j?void 0!==m:null,h=null!=m?m:"UTC",g=(t,e)=>t===d.Wj.local&&m?h:e;a()}catch(u){a(u)}})},69543:function(t,e,i){i.d(e,{J:function(){return o}});i(74423);var a=i(22786),n=i(46927);const o=(0,a.A)(t=>{if(t.time_format===n.Hg.language||t.time_format===n.Hg.system){const e=t.time_format===n.Hg.language?t.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(e).includes("10")}return t.time_format===n.Hg.am_pm})},20058:function(t,e,i){i.a(t,async function(t,a){try{i.d(e,{QL:function(){return u},ZQ:function(){return m},ZV:function(){return l},ty:function(){return s},x:function(){return c}});var n=i(74487),o=(i(74423),i(18111),i(61701),i(46927)),r=t([n]);n=(r.then?(await r)():r)[0];const c=t=>s(t.attributes),s=(t,e)=>!!t.unit_of_measurement||!!t.state_class||(e||[]).includes(t.device_class||""),d=t=>{switch(t.number_format){case o.jG.comma_decimal:return["en-US","en"];case o.jG.decimal_comma:return["de","es","it"];case o.jG.space_comma:return["fr","sv","cs"];case o.jG.quote_decimal:return["de-CH"];case o.jG.system:return;default:return t.language}},l=(t,e,i)=>u(t,e,i).map(t=>t.value).join(""),u=(t,e,i)=>{const a=e?d(e):void 0;return(null==e?void 0:e.number_format)===o.jG.none||Number.isNaN(Number(t))?Number.isNaN(Number(t))||""===t||(null==e?void 0:e.number_format)!==o.jG.none?[{type:"literal",value:t}]:new Intl.NumberFormat("en-US",f(t,Object.assign(Object.assign({},i),{},{useGrouping:!1}))).formatToParts(Number(t)):new Intl.NumberFormat(a,f(t,i)).formatToParts(Number(t))},m=(t,e)=>{var i;const a=null==e?void 0:e.display_precision;return null!=a?{maximumFractionDigits:a,minimumFractionDigits:a}:Number.isInteger(Number(null==t||null===(i=t.attributes)||void 0===i?void 0:i.step))&&Number.isInteger(Number(null==t?void 0:t.state))?{maximumFractionDigits:0}:void 0},f=(t,e)=>{const i=Object.assign({maximumFractionDigits:2},e);if("string"!=typeof t)return i;if(!e||void 0===e.minimumFractionDigits&&void 0===e.maximumFractionDigits){const e=t.indexOf(".")>-1?t.split(".")[1].length:0;i.minimumFractionDigits=e,i.maximumFractionDigits=e}return i};a()}catch(c){a(c)}})},47680:function(t,e,i){i.r(e),i.d(e,{HaIcon:function(){return j}});i(74423),i(3362),i(62953);var a=i(40445),n=i(5124),o=i(67576),r=i(1087),c=i(9899),s=i(700),d=(i(44114),i(18111),i(7588),i(96167),i(95192)),l=i(7553);const u=JSON.parse('{"version":"7.4.47","parts":[{"file":"7a7139d465f1f41cb26ab851a17caa21a9331234"},{"start":"account-supervisor-circle-","file":"9561286c4c1021d46b9006596812178190a7cc1c"},{"start":"alpha-r-c","file":"eb466b7087fb2b4d23376ea9bc86693c45c500fa"},{"start":"arrow-decision-o","file":"4b3c01b7e0723b702940c5ac46fb9e555646972b"},{"start":"baby-f","file":"2611401d85450b95ab448ad1d02c1a432b409ed2"},{"start":"battery-hi","file":"89bcd31855b34cd9d31ac693fb073277e74f1f6a"},{"start":"blur-r","file":"373709cd5d7e688c2addc9a6c5d26c2d57c02c48"},{"start":"briefcase-account-","file":"a75956cf812ee90ee4f656274426aafac81e1053"},{"start":"calendar-question-","file":"3253f2529b5ebdd110b411917bacfacb5b7063e6"},{"start":"car-lig","file":"74566af3501ad6ae58ad13a8b6921b3cc2ef879d"},{"start":"cellphone-co","file":"7677f1cfb2dd4f5562a2aa6d3ae43a2e6997b21a"},{"start":"circle-slice-2","file":"70d08c50ec4522dd75d11338db57846588263ee2"},{"start":"cloud-co","file":"141d2bfa55ca4c83f4bae2812a5da59a84fec4ff"},{"start":"cog-s","file":"5a640365f8e47c609005d5e098e0e8104286d120"},{"start":"cookie-l","file":"dd85b8eb8581b176d3acf75d1bd82e61ca1ba2fc"},{"start":"currency-eur-","file":"15362279f4ebfc3620ae55f79d2830ad86d5213e"},{"start":"delete-o","file":"239434ab8df61237277d7599ebe066c55806c274"},{"start":"draw-","file":"5605918a592070803ba2ad05a5aba06263da0d70"},{"start":"emoticon-po","file":"a838cfcec34323946237a9f18e66945f55260f78"},{"start":"fan","file":"effd56103b37a8c7f332e22de8e4d67a69b70db7"},{"start":"file-question-","file":"b2424b50bd465ae192593f1c3d086c5eec893af8"},{"start":"flask-off-","file":"3b76295cde006a18f0301dd98eed8c57e1d5a425"},{"start":"food-s","file":"1c6941474cbeb1755faaaf5771440577f4f1f9c6"},{"start":"gamepad-u","file":"c6efe18db6bc9654ae3540c7dee83218a5450263"},{"start":"google-f","file":"df341afe6ad4437457cf188499cb8d2df8ac7b9e"},{"start":"head-c","file":"282121c9e45ed67f033edcc1eafd279334c00f46"},{"start":"home-pl","file":"27e8e38fc7adcacf2a210802f27d841b49c8c508"},{"start":"inbox-","file":"0f0316ec7b1b7f7ce3eaabce26c9ef619b5a1694"},{"start":"key-v","file":"ea33462be7b953ff1eafc5dac2d166b210685a60"},{"start":"leaf-circle-","file":"33db9bbd66ce48a2db3e987fdbd37fb0482145a4"},{"start":"lock-p","file":"b89e27ed39e9d10c44259362a4b57f3c579d3ec8"},{"start":"message-s","file":"7b5ab5a5cadbe06e3113ec148f044aa701eac53a"},{"start":"moti","file":"01024d78c248d36805b565e343dd98033cc3bcaf"},{"start":"newspaper-variant-o","file":"22a6ec4a4fdd0a7c0acaf805f6127b38723c9189"},{"start":"on","file":"c73d55b412f394e64632e2011a59aa05e5a1f50d"},{"start":"paw-ou","file":"3f669bf26d16752dc4a9ea349492df93a13dcfbf"},{"start":"pigg","file":"0c24edb27eb1c90b6e33fc05f34ef3118fa94256"},{"start":"printer-pos-sy","file":"41a55cda866f90b99a64395c3bb18c14983dcf0a"},{"start":"read","file":"c7ed91552a3a64c9be88c85e807404cf705b7edf"},{"start":"robot-vacuum-variant-o","file":"917d2a35d7268c0ea9ad9ecab2778060e19d90e0"},{"start":"sees","file":"6e82d9861d8fac30102bafa212021b819f303bdb"},{"start":"shoe-f","file":"e2fe7ce02b5472301418cc90a0e631f187b9f238"},{"start":"snowflake-m","file":"a28ba9f5309090c8b49a27ca20ff582a944f6e71"},{"start":"st","file":"7e92d03f095ec27e137b708b879dfd273bd735ab"},{"start":"su","file":"61c74913720f9de59a379bdca37f1d2f0dc1f9db"},{"start":"tag-plus-","file":"8f3184156a4f38549cf4c4fffba73a6a941166ae"},{"start":"timer-a","file":"baab470d11cfb3a3cd3b063ee6503a77d12a80d0"},{"start":"transit-d","file":"8561c0d9b1ac03fab360fd8fe9729c96e8693239"},{"start":"vector-arrange-b","file":"c9a3439257d4bab33d3355f1f2e11842e8171141"},{"start":"water-ou","file":"02dbccfb8ca35f39b99f5a085b095fc1275005a0"},{"start":"webc","file":"57bafd4b97341f4f2ac20a609d023719f23a619c"},{"start":"zip","file":"65ae094e8263236fa50486584a08c03497a38d93"}]}');let m;const f=()=>(m||(m=h().catch(t=>{throw m=void 0,t})),m),h=async()=>{const t=(0,d.y$)("hass-icon-db","mdi-icon-store"),e=await(0,d.Jt)("_version",t);return e?e!==u.version&&(await(0,d.IU)(t),(0,d.hZ)("_version",u.version,t)):(0,d.hZ)("_version",u.version,t),t},g=["mdi","hass","hassio","hademo"];let b=[];i(67094);let p,v,_,y=t=>t;const w={},k={},z=(0,c.s)(()=>(async t=>{const e=Object.keys(t),i=await Promise.allSettled(Object.values(t));(await f())("readwrite",a=>{i.forEach((i,n)=>{"fulfilled"===i.status&&Object.entries(i.value).forEach(([t,e])=>{a.put(e,t)}),delete t[e[n]]})})})(k),2e3),C={},M={"home-assistant":()=>i.e(58781).then(i.bind(i,53580)).then(t=>t.mdiHomeAssistant),"music-assistant":()=>i.e(56009).then(i.bind(i,10576)).then(t=>t.mdiMusicAssistant),esphome:()=>i.e(88800).then(i.bind(i,45091)).then(t=>t.mdiEsphomeLogo)};class j extends n.WF{willUpdate(t){super.willUpdate(t),t.has("icon")&&(this._path=void 0,this._secondaryPath=void 0,this._viewBox=void 0,this._loadIcon())}render(){return this.icon?this._legacy?(0,n.qy)(p||(p=y` <iron-icon .icon="${0}"></iron-icon>`),this.icon):(0,n.qy)(v||(v=y`<ha-svg-icon .path="${0}" .secondaryPath="${0}" .viewBox="${0}"></ha-svg-icon>`),this._path,this._secondaryPath,this._viewBox):n.s6}async _loadIcon(){if(!this.icon)return;const t=this.icon,[e,i]=this.icon.split(":",2);let a,n=i;if(!e||!n)return;if(!g.includes(e)){const i=s.y[e];return i?void(i&&"function"==typeof i.getIcon&&this._setCustomPath(i.getIcon(n),t)):void(this._legacy=!0)}if(this._legacy=!1,n in w){const t=w[n];let i;t.newName?(i=`Icon ${e}:${n} was renamed to ${e}:${t.newName}, please change your config, it will be removed in version ${t.removeIn}.`,n=t.newName):i=`Icon ${e}:${n} was removed from MDI, please replace this icon with an other icon in your config, it will be removed in version ${t.removeIn}.`,console.warn(i),(0,r.r)(this,"write_log",{level:"warning",message:i})}if(n in C)return void(this._path=C[n]);if(n in M){const e=await M[n]();return this.icon===t&&(this._path=e),void(C[n]=e)}try{a=await(t=>new Promise((e,i)=>{if(b.push([t,e,i]),b.length>1)return;const a=f();(0,l.h)(1e3,(async()=>{(await a)("readonly",t=>{for(const[e,i,a]of b)(0,d.Yd)(t.get(e)).then(t=>i(t)).catch(t=>a(t));b=[]})})()).catch(t=>{for(const[,,e]of b)e(t);b=[]})}))(n)}catch(m){a=void 0}if(a)return this.icon===t&&(this._path=a),void(C[n]=a);const o=(t=>{let e;for(const i of u.parts){if(void 0!==i.start&&t<i.start)break;e=i}return e.file})(n);if(o in k)return void this._setPath(k[o],n,t);const c=fetch(`/static/mdi/${o}.json`).then(t=>t.json());k[o]=c,this._setPath(c,n,t),c.catch(()=>{delete k[o]}),z()}async _setCustomPath(t,e){const i=await t;this.icon===e&&(this._path=i.path,this._secondaryPath=i.secondaryPath,this._viewBox=i.viewBox)}async _setPath(t,e,i){try{const a=await t;this.icon===i&&(this._path=a[e]),C[e]=a[e]}catch(a){}}constructor(...t){super(...t),this._legacy=!1}}j.styles=(0,n.AH)(_||(_=y`:host{fill:currentcolor}`)),(0,a.Cg)([(0,o.MZ)()],j.prototype,"icon",void 0),(0,a.Cg)([(0,o.wk)()],j.prototype,"_path",void 0),(0,a.Cg)([(0,o.wk)()],j.prototype,"_secondaryPath",void 0),(0,a.Cg)([(0,o.wk)()],j.prototype,"_viewBox",void 0),(0,a.Cg)([(0,o.wk)()],j.prototype,"_legacy",void 0),j=(0,a.Cg)([(0,o.EM)("ha-icon")],j)},93367:function(t,e,i){i.a(t,async function(t,e){try{var a=i(40445),n=i(35211),o=i(5124),r=i(67576),c=i(91450),s=i(69093),d=i(22792),l=i(85694),u=(i(47680),i(67094),t([l]));l=(u.then?(await u)():u)[0];let m,f,h,g,b=t=>t;class p extends o.WF{render(){var t,e;const i=this.icon||this.stateObj&&(null===(t=this._entities)||void 0===t||null===(t=t[this.stateObj.entity_id])||void 0===t?void 0:t.icon)||(null===(e=this.stateObj)||void 0===e?void 0:e.attributes.icon);if(i)return(0,o.qy)(m||(m=b`<ha-icon .icon="${0}"></ha-icon>`),i);if(!this.stateObj)return o.s6;if(!this._config||!this._connection||!this._entities)return this._renderFallback();const a=(0,l.fq)(this._entities,this._config.config,this._connection.connection,this.stateObj,this.stateValue).then(t=>t?(0,o.qy)(f||(f=b`<ha-icon .icon="${0}"></ha-icon>`),t):this._renderFallback());return(0,o.qy)(h||(h=b`${0}`),(0,c.T)(a))}_renderFallback(){const t=(0,s.t)(this.stateObj);return(0,o.qy)(g||(g=b` <ha-svg-icon .path="${0}"></ha-svg-icon> `),l.l[t]||l.lW)}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"stateObj",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"stateValue",void 0),(0,a.Cg)([(0,r.MZ)()],p.prototype,"icon",void 0),(0,a.Cg)([(0,r.wk)(),(0,n.Fg)({context:d.WF,subscribe:!0})],p.prototype,"_config",void 0),(0,a.Cg)([(0,r.wk)(),(0,n.Fg)({context:d.Wq,subscribe:!0})],p.prototype,"_connection",void 0),(0,a.Cg)([(0,r.wk)(),(0,n.Fg)({context:d.X1,subscribe:!0})],p.prototype,"_entities",void 0),p=(0,a.Cg)([(0,r.EM)("ha-state-icon")],p),e()}catch(m){e(m)}})},99257:function(t,e,i){i.a(t,async function(t,e){try{i(44114),i(18111),i(22489),i(7588),i(61701),i(3362),i(62953);var a=i(40445),n=i(5124),o=i(67576),r=i(22786),c=i(1087),s=(i(3449),i(22273)),d=t([s]);s=(d.then?(await d)():d)[0];let l,u,m,f=t=>t;class h extends n.WF{fitMap(t){this.map.fitMap(t)}fitBounds(t,e){this.map.fitBounds(t,e)}async fitMarker(t,e){if(this.Leaflet||await this._loadPromise,!this.map.leafletMap||!this._locationMarkers)return;const i=this._locationMarkers[t];if(i)if("getBounds"in i)this.map.leafletMap.fitBounds(i.getBounds()),i.bringToFront();else{const a=this._circles[t];a?this.map.leafletMap.fitBounds(a.getBounds()):this.map.leafletMap.setView(i.getLatLng(),(null==e?void 0:e.zoom)||this.zoom)}}render(){return(0,n.qy)(l||(l=f` <ha-map .hass="${0}" .layers="${0}" .zoom="${0}" .autoFit="${0}" .themeMode="${0}" .clickable="${0}" @map-clicked="${0}"></ha-map> ${0} `),this.hass,this._getLayers(this._circles,this._locationMarkers),this.zoom,this.autoFit,this.themeMode,this.pinOnClick,this._mapClicked,this.helper?(0,n.qy)(u||(u=f`<ha-input-helper-text>${0}</ha-input-helper-text>`),this.helper):"")}willUpdate(t){super.willUpdate(t),this.Leaflet&&t.has("locations")&&this._updateMarkers()}updated(t){if(this.Leaflet&&t.has("locations")){var e;const a=t.get("locations"),n=null===(e=this.locations)||void 0===e?void 0:e.filter((t,e)=>{var i,n;return!a[e]||(t.latitude!==a[e].latitude||t.longitude!==a[e].longitude)&&(null===(i=this.map.leafletMap)||void 0===i?void 0:i.getBounds().contains({lat:a[e].latitude,lng:a[e].longitude}))&&!(null!==(n=this.map.leafletMap)&&void 0!==n&&n.getBounds().contains({lat:t.latitude,lng:t.longitude}))});var i;if(1===(null==n?void 0:n.length))null===(i=this.map.leafletMap)||void 0===i||i.panTo({lat:n[0].latitude,lng:n[0].longitude})}}_normalizeLongitude(t){return Math.abs(t)>180?(t%360+540)%360-180:t}_updateLocation(t){const e=t.target,i=e.getLatLng(),a=[i.lat,this._normalizeLongitude(i.lng)];(0,c.r)(this,"location-updated",{id:e.id,location:a},{bubbles:!1})}_updateRadius(t){const e=t.target,i=this._locationMarkers[e.id];(0,c.r)(this,"radius-updated",{id:e.id,radius:i.getRadius()},{bubbles:!1})}_markerClicked(t){const e=t.target;(0,c.r)(this,"marker-clicked",{id:e.id},{bubbles:!1})}_mapClicked(t){if(this.pinOnClick&&this._locationMarkers){const i=Object.keys(this._locationMarkers)[0],a=[t.detail.location[0],this._normalizeLongitude(t.detail.location[1])];var e;if((0,c.r)(this,"location-updated",{id:i,location:a},{bubbles:!1}),a[1]!==t.detail.location[1])null===(e=this.map.leafletMap)||void 0===e||e.panTo({lat:a[0],lng:a[1]})}}_updateMarkers(){if(!this.locations||!this.locations.length)return this._circles={},void(this._locationMarkers=void 0);const t={},e={},i=getComputedStyle(this).getPropertyValue("--accent-color");this.locations.forEach(a=>{let n;if(a.icon||a.iconPath){const t=document.createElement("div");let e;t.className="named-icon",void 0!==a.name&&(t.innerText=a.name),a.icon?(e=document.createElement("ha-icon"),e.setAttribute("icon",a.icon)):(e=document.createElement("ha-svg-icon"),e.setAttribute("path",a.iconPath)),t.prepend(e),n=this.Leaflet.divIcon({html:t.outerHTML,iconSize:[24,24],className:"light"})}if(a.radius){const o=this.Leaflet.circle([a.latitude,a.longitude],{color:a.radius_color||i,radius:a.radius});a.radius_editable||a.location_editable?(o.editing.enable(),o.addEventListener("add",()=>{const t=o.editing._moveMarker,e=o.editing._resizeMarkers[0];n&&t.setIcon(n),e.id=t.id=a.id,t.addEventListener("dragend",t=>this._updateLocation(t)).addEventListener("click",t=>this._markerClicked(t)),a.radius_editable?e.addEventListener("dragend",t=>this._updateRadius(t)):e.remove()}),t[a.id]=o):e[a.id]=o}if(!a.radius||!a.radius_editable&&!a.location_editable){const e={title:a.name,draggable:a.location_editable};n&&(e.icon=n);const i=this.Leaflet.marker([a.latitude,a.longitude],e).addEventListener("dragend",t=>this._updateLocation(t)).addEventListener("click",t=>this._markerClicked(t));i.id=a.id,t[a.id]=i}}),this._circles=e,this._locationMarkers=t,(0,c.r)(this,"markers-updated")}constructor(){super(),this.autoFit=!1,this.zoom=16,this.themeMode="auto",this.pinOnClick=!1,this._circles={},this._getLayers=(0,r.A)((t,e)=>{const i=[];return Array.prototype.push.apply(i,Object.values(t)),e&&Array.prototype.push.apply(i,Object.values(e)),i}),this._loadPromise=Promise.resolve().then(i.t.bind(i,78572,23)).then(t=>i.e(99293).then(i.t.bind(i,60108,23)).then(()=>(this.Leaflet=t.default,this._updateMarkers(),this.updateComplete.then(()=>this.fitMap()))))}}h.styles=(0,n.AH)(m||(m=f`ha-map{display:block;height:100%}`)),(0,a.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"locations",void 0),(0,a.Cg)([(0,o.MZ)()],h.prototype,"helper",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"auto-fit",type:Boolean})],h.prototype,"autoFit",void 0),(0,a.Cg)([(0,o.MZ)({type:Number})],h.prototype,"zoom",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"theme-mode",type:String})],h.prototype,"themeMode",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,attribute:"pin-on-click"})],h.prototype,"pinOnClick",void 0),(0,a.Cg)([(0,o.wk)()],h.prototype,"_locationMarkers",void 0),(0,a.Cg)([(0,o.wk)()],h.prototype,"_circles",void 0),(0,a.Cg)([(0,o.P)("ha-map",!0)],h.prototype,"map",void 0),h=(0,a.Cg)([(0,o.EM)("ha-locations-editor")],h),e()}catch(l){e(l)}})},700:function(t,e,i){i.d(e,{y:function(){return r}});const a=window;"customIconsets"in a||(a.customIconsets={});const n=a.customIconsets,o=window;"customIcons"in o||(o.customIcons={});const r=new Proxy(o.customIcons,{get:(t,e)=>{var i;return null!==(i=t[e])&&void 0!==i?i:n[e]?{getIcon:n[e]}:void 0}})},53580:function(t,e,i){i.d(e,{mdiHomeAssistant:function(){return a}});const a="m12.151 1.5882c-.3262 0-.6523.1291-.8996.3867l-8.3848 8.7354c-.0619.0644-.1223.1368-.1807.2154-.0588.0789-.1151.1638-.1688.2534-.2593.4325-.4552.9749-.5232 1.4555-.0026.018-.0076.0369-.0094.0548-.0121.0987-.0184.1944-.0184.2857v8.0124a1.2731 1.2731 0 001.2731 1.2731h7.8313l-3.4484-3.593a1.7399 1.7399 0 111.0803-1.125l2.6847 2.7972v-10.248a1.7399 1.7399 0 111.5276-0v7.187l2.6702-2.782a1.7399 1.7399 0 111.0566 1.1505l-3.7269 3.8831v2.7299h8.174a1.2471 1.2471 0 001.2471-1.2471v-8.0375c0-.0912-.0059-.1868-.0184-.2855-.0603-.4935-.2636-1.0617-.5326-1.5105-.0537-.0896-.1101-.1745-.1684-.253-.0588-.079-.1191-.1513-.181-.2158l-8.3848-8.7363c-.2473-.2577-.5735-.3866-.8995-.3864"},88438:function(t,e,i){i.d(e,{C:function(){return a}});const a="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}}]);