iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
3 lines • 10.8 kB
JavaScript
/*! For license information please see 69642.1dbdb5ee17716ccc.js.LICENSE.txt */
export const __webpack_ids__=["69642"];export const __webpack_modules__={20130:function(e,t,i){var n=i(44249),a=i(72621),s=i(39785),o=i(52876),r=i(15093),c=i(57243),l=i(5111);(0,n.Z)([(0,r.Mo)("ha-fab")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"method",key:"firstUpdated",value:function(e){(0,a.Z)(i,"firstUpdated",this,3)([e]),this.style.setProperty("--mdc-theme-secondary","var(--primary-color)")}},{kind:"field",static:!0,key:"styles",value:()=>[o.W,c.iv`:host .mdc-fab--extended .mdc-fab__icon{margin-inline-start:-8px;margin-inline-end:12px;direction:var(--direction)}:disabled{--mdc-theme-secondary:var(--disabled-text-color);pointer-events:none}`,"rtl"===l.E.document.dir?c.iv`:host .mdc-fab--extended .mdc-fab__icon{direction:rtl}`:c.iv``]}]}}),s._)},279:function(e,t,i){i.d(t,{Qc:()=>l,Xr:()=>c,zJ:()=>r});i(9359),i(31526),i(92519),i(42179),i(89256),i(24931),i(88463),i(57449),i(19814);const n=["zone","persistent_notification"],a=(e,t)=>{if("call-service"!==t.action||!t.target?.entity_id&&!t.service_data?.entity_id&&!t.data?.entity_id)return;let i=t.service_data?.entity_id??t.data?.entity_id??t.target?.entity_id;Array.isArray(i)||(i=[i]);for(const t of i)e.add(t)},s=(e,t)=>{t&&("string"!=typeof t?(t.entity&&e.add(t.entity),t.camera_image&&e.add(t.camera_image),t.tap_action&&a(e,t.tap_action),t.hold_action&&a(e,t.hold_action)):e.add(t))},o=(e,t)=>{t.entity&&s(e,t.entity),t.entities&&Array.isArray(t.entities)&&t.entities.forEach((t=>s(e,t))),t.card&&o(e,t.card),t.cards&&Array.isArray(t.cards)&&t.cards.forEach((t=>o(e,t))),t.elements&&Array.isArray(t.elements)&&t.elements.forEach((t=>o(e,t))),t.badges&&Array.isArray(t.badges)&&t.badges.forEach((t=>s(e,t))),t.sections&&Array.isArray(t.sections)&&t.sections.forEach((t=>o(e,t)))},r=e=>{const t=new Set;return e.views.forEach((e=>{o(t,e)})),t},c=(e,t)=>{const i=new Set;for(const a of Object.keys(e.states))t.has(a)||n.includes(a.split(".",1)[0])||i.add(a);return i},l=(e,t)=>{const i=r(t);return c(e,i)}},53380:function(e,t,i){i.d(t,{f:()=>s});var n=i(36522);const a=()=>Promise.all([i.e("35671"),i.e("83895"),i.e("29570"),i.e("65505"),i.e("8795"),i.e("71588"),i.e("92139"),i.e("32146"),i.e("7068"),i.e("47399"),i.e("79346"),i.e("63055"),i.e("52358"),i.e("44251"),i.e("65005"),i.e("60487"),i.e("92691"),i.e("38326"),i.e("16912"),i.e("70639"),i.e("92368"),i.e("37316"),i.e("80312"),i.e("34482")]).then(i.bind(i,22958)),s=(e,t)=>{(0,n.B)(e,"show-dialog",{dialogTag:"hui-dialog-suggest-card",dialogImport:a,dialogParams:t})}},74941:function(e,t,i){i.d(t,{i:()=>a});var n=i(36522);const a=(e,t)=>{(0,n.B)(e,"show-dialog",{dialogTag:"hui-dialog-select-view",dialogImport:()=>Promise.all([i.e("97983"),i.e("41258"),i.e("35671"),i.e("7010"),i.e("5851")]).then(i.bind(i,67271)),dialogParams:t})}},39507:function(e,t,i){i.a(e,(async function(e,n){try{i.r(t),i.d(t,{HuiUnusedEntities:()=>m});var a=i(44249),s=i(72621),o=(i(9359),i(70104),i(57243)),r=i(15093),c=i(35359),l=i(73850),d=i(47194),u=(i(20130),i(37583),i(279)),h=i(71971),f=i(53380),g=i(74941),v=i(20526),p=e([h]);h=(p.then?(await p)():p)[0];const y="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";let m=(0,a.Z)([(0,r.Mo)("hui-unused-entities")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_unusedEntities",value:()=>[]},{kind:"field",decorators:[(0,r.SB)()],key:"_selectedEntities",value:()=>[]},{kind:"get",key:"_config",value:function(){return this.lovelace.config}},{kind:"method",key:"updated",value:function(e){(0,s.Z)(i,"updated",this,3)([e]),e.has("lovelace")&&this._getUnusedEntities()}},{kind:"method",key:"render",value:function(){return this.hass&&this.lovelace?"storage"===this.lovelace.mode&&!1===this.lovelace.editMode?o.Ld:o.dy` <div class="container"> ${this.narrow?"":o.dy` <ha-card header="${this.hass.localize("ui.panel.lovelace.unused_entities.title")}"> <div class="card-content"> ${this.hass.localize("ui.panel.lovelace.unused_entities.available_entities")} ${"storage"===this.lovelace.mode?o.dy` <br>${this.hass.localize("ui.panel.lovelace.unused_entities.select_to_add")} `:""} </div> </ha-card> `} <hui-entity-picker-table .hass="${this.hass}" .narrow="${this.narrow}" .entities="${this._unusedEntities.map((e=>{const t=this.hass.states[e];return{icon:"",entity_id:e,stateObj:t,name:t?(0,d.C)(t):"Unavailable",domain:(0,l.M)(e),last_changed:t?.last_changed}}))}" @selected-changed="${this._handleSelectedChanged}"></hui-entity-picker-table> </div> <div class="fab ${(0,c.$)({selected:this._selectedEntities.length})}"> <ha-fab .label="${this.hass.localize("ui.panel.lovelace.editor.edit_card.add")}" extended @click="${this._addToLovelaceView}"> <ha-svg-icon slot="icon" .path="${y}"></ha-svg-icon> </ha-fab> </div> `:o.Ld}},{kind:"method",key:"_getUnusedEntities",value:function(){if(!this.hass||!this.lovelace)return;this._selectedEntities=[];const e=(0,u.Qc)(this.hass,this._config);this._unusedEntities=[...e].sort()}},{kind:"method",key:"_handleSelectedChanged",value:function(e){this._selectedEntities=e.detail.selectedEntities}},{kind:"method",key:"_addToLovelaceView",value:function(){const e=(0,v.VG)(this.hass.states,this._selectedEntities,{}),t=(0,v.lY)(this._selectedEntities,{});1!==this.lovelace.config.views.length?(0,g.i)(this,{lovelaceConfig:this.lovelace.config,allowDashboardChange:!1,viewSelectedCallback:(i,n,a)=>{(0,f.f)(this,{lovelaceConfig:this.lovelace.config,saveConfig:this.lovelace.saveConfig,path:[a],entities:this._selectedEntities,cardConfig:e,sectionConfig:t})}}):(0,f.f)(this,{lovelaceConfig:this.lovelace.config,saveConfig:this.lovelace.saveConfig,path:[0],entities:this._selectedEntities,cardConfig:e,sectionConfig:t})}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{overflow:hidden}.container{display:flex;flex-direction:column;height:100%}ha-card{--ha-card-box-shadow:none;--ha-card-border-radius:0}hui-entity-picker-table{flex-grow:1}.fab{position:sticky;float:var(--float-end);right:calc(16px + env(safe-area-inset-right));bottom:calc(16px + env(safe-area-inset-bottom));inset-inline-end:calc(16px + env(safe-area-inset-right));inset-inline-start:initial;z-index:1}ha-fab{position:relative;bottom:calc(-80px - env(safe-area-inset-bottom));transition:bottom .3s}.fab.selected ha-fab{bottom:0}`}]}}),o.oi);n()}catch(e){n(e)}}))},75351:function(e,t,i){i.d(t,{Ud:()=>h});i(9359),i(70104),i(48136);const n=Symbol("Comlink.proxy"),a=Symbol("Comlink.endpoint"),s=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),r=Symbol("Comlink.thrown"),c=e=>"object"==typeof e&&null!==e||"function"==typeof e,l=new Map([["proxy",{canHandle:e=>c(e)&&e[n],serialize(e){const{port1:t,port2:i}=new MessageChannel;return d(e,t),[i,[i]]},deserialize:e=>(e.start(),h(e))}],["throw",{canHandle:e=>c(e)&&r in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function d(e,t=globalThis,i=["*"]){t.addEventListener("message",(function a(s){if(!s||!s.data)return;if(!function(e,t){for(const i of e){if(t===i||"*"===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}return!1}(i,s.origin))return void console.warn(`Invalid origin '${s.origin}' for comlink proxy`);const{id:c,type:l,path:h}=Object.assign({path:[]},s.data),f=(s.data.argumentList||[]).map(k);let g;try{const t=h.slice(0,-1).reduce(((e,t)=>e[t]),e),i=h.reduce(((e,t)=>e[t]),e);switch(l){case"GET":g=i;break;case"SET":t[h.slice(-1)[0]]=k(s.data.value),g=!0;break;case"APPLY":g=i.apply(t,f);break;case"CONSTRUCT":g=function(e){return Object.assign(e,{[n]:!0})}(new i(...f));break;case"ENDPOINT":{const{port1:t,port2:i}=new MessageChannel;d(e,i),g=function(e,t){return b.set(e,t),e}(t,[t])}break;case"RELEASE":g=void 0;break;default:return}}catch(e){g={value:e,[r]:0}}Promise.resolve(g).catch((e=>({value:e,[r]:0}))).then((i=>{const[n,s]=_(i);t.postMessage(Object.assign(Object.assign({},n),{id:c}),s),"RELEASE"===l&&(t.removeEventListener("message",a),u(t),o in e&&"function"==typeof e[o]&&e[o]())})).catch((e=>{const[i,n]=_({value:new TypeError("Unserializable return value"),[r]:0});t.postMessage(Object.assign(Object.assign({},i),{id:c}),n)}))})),t.start&&t.start()}function u(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function h(e,t){const i=new Map;return e.addEventListener("message",(function(e){const{data:t}=e;if(!t||!t.id)return;const n=i.get(t.id);if(n)try{n(t)}finally{i.delete(t.id)}})),y(e,i,[],t)}function f(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return E(e,new Map,{type:"RELEASE"}).then((()=>{u(e)}))}const v=new WeakMap,p="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(v.get(e)||0)-1;v.set(e,t),0===t&&g(e)}));function y(e,t,i=[],n=function(){}){let o=!1;const r=new Proxy(n,{get(n,a){if(f(o),a===s)return()=>{!function(e){p&&p.unregister(e)}(r),g(e),t.clear(),o=!0};if("then"===a){if(0===i.length)return{then:()=>r};const n=E(e,t,{type:"GET",path:i.map((e=>e.toString()))}).then(k);return n.then.bind(n)}return y(e,t,[...i,a])},set(n,a,s){f(o);const[r,c]=_(s);return E(e,t,{type:"SET",path:[...i,a].map((e=>e.toString())),value:r},c).then(k)},apply(n,s,r){f(o);const c=i[i.length-1];if(c===a)return E(e,t,{type:"ENDPOINT"}).then(k);if("bind"===c)return y(e,t,i.slice(0,-1));const[l,d]=m(r);return E(e,t,{type:"APPLY",path:i.map((e=>e.toString())),argumentList:l},d).then(k)},construct(n,a){f(o);const[s,r]=m(a);return E(e,t,{type:"CONSTRUCT",path:i.map((e=>e.toString())),argumentList:s},r).then(k)}});return function(e,t){const i=(v.get(t)||0)+1;v.set(t,i),p&&p.register(e,t,e)}(r,e),r}function m(e){const t=e.map(_);return[t.map((e=>e[0])),(i=t.map((e=>e[1])),Array.prototype.concat.apply([],i))];var i}const b=new WeakMap;function _(e){for(const[t,i]of l)if(i.canHandle(e)){const[n,a]=i.serialize(e);return[{type:"HANDLER",name:t,value:n},a]}return[{type:"RAW",value:e},b.get(e)||[]]}function k(e){switch(e.type){case"HANDLER":return l.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,i,n){return new Promise((a=>{const s=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.set(s,a),e.start&&e.start(),e.postMessage(Object.assign({id:s},i),n)}))}}};
//# sourceMappingURL=69642.1dbdb5ee17716ccc.js.map