UNPKG

iobroker.lovelace

Version:

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

1 lines 7.21 kB
export const __rspack_esm_id=74723;export const __rspack_esm_ids=[74723];export const __webpack_modules__={26571(e,i,t){t.d(i,{Al:()=>n,KY:()=>o,PN:()=>c,dG:()=>l,jm:()=>d,m7:()=>_,sR:()=>h,t1:()=>r,t2:()=>g,x:()=>u,yu:()=>p});var s=t(95350);const o=["bluetooth","dhcp","discovery","esphome","hardware","hassio","homekit","integration_discovery","mqtt","ssdp","unignore","usb","zeroconf"],n=["reauth"],a={"HA-Frontend-Base":`${location.protocol}//${location.host}`},r=(e,i,t)=>e.callApi("POST","config/config_entries/flow",{handler:i,entry_id:t},a),c=(e,i)=>e.callApi("GET",`config/config_entries/flow/${i}`,void 0,a),d=(e,i,t)=>e.callApi("POST",`config/config_entries/flow/${i}`,t,a),l=(e,i,t)=>e.callWS({type:"config_entries/ignore_flow",flow_id:i,title:t}),h=(e,i)=>e.callApi("DELETE",`config/config_entries/flow/${i}`),p=(e,i)=>e.callApi("GET","config/config_entries/flow_handlers"+(i?`?type=${i}`:"")),g=e=>e.sendMessagePromise({type:"config_entries/flow/progress"}),u=(e,i)=>e.connection.subscribeMessage(e=>i(e),{type:"config_entries/flow/subscribe"}),_=(e,i)=>i.context.title_placeholders&&0!==Object.keys(i.context.title_placeholders).length?e(`component.${i.handler}.config.flow_title`,i.context.title_placeholders)||("name"in i.context.title_placeholders?i.context.title_placeholders.name:(0,s.p$)(e,i.handler)):(0,s.p$)(e,i.handler)},42262(e,i,t){t.d(i,{$:()=>s,l:()=>o});const s=e=>e.callWS({type:"usb/scan"}),o=e=>e.callWS({type:"usb/list_serial_ports"})},54706(e,i,t){t.d(i,{E:()=>n});t(74423),t(18111),t(13579);var s=t(62826),o=t(22441);const n=e=>{class i extends e{connectedCallback(){super.connectedCallback(),this._checkSubscribed()}disconnectedCallback(){if(super.disconnectedCallback(),this.__unsubs){for(;this.__unsubs.length;){const e=this.__unsubs.pop();e instanceof Promise?e.then(e=>e()):e()}this.__unsubs=void 0}}updated(e){if(super.updated(e),e.has("hass"))this._checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const i of e.keys())if(this.hassSubscribeRequiredHostProps.includes(i))return void this._checkSubscribed()}hassSubscribe(){return[]}_checkSubscribed(){void 0===this.__unsubs&&this.isConnected&&void 0!==this.hass&&!this.hassSubscribeRequiredHostProps?.some(e=>void 0===this[e])&&(this.__unsubs=this.hassSubscribe())}}return(0,s.Cg)([(0,o.MZ)({attribute:!1})],i.prototype,"hass",void 0),i}},73561(e,i,t){var s=t(62826),o=t(5124),n=t(22441),a=t(44144);class r extends o.WF{render(){return o.qy` <div class="icon"> <img alt="" src="${(0,a.MR)({domain:this.domain,type:"icon",darkOptimized:this.darkOptimizedIcon},location.origin)}" crossorigin="anonymous" referrerpolicy="no-referrer"> </div> <div class="title">${this.title}</div> `}constructor(...e){super(...e),this.darkOptimizedIcon=!1,this.clickable=!1}}r.styles=o.AH`:host{display:inline-flex;flex-direction:column;text-align:center;color:var(--primary-text-color)}img{max-width:100%;max-height:100%}.icon{position:relative;margin:0 auto 8px;height:40px;width:40px;display:flex;align-items:center;justify-content:center}.title{min-height:2.3em;word-break:break-word}`,(0,s.Cg)([(0,n.MZ)()],r.prototype,"domain",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],r.prototype,"title",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"dark-optimized-icon",type:Boolean})],r.prototype,"darkOptimizedIcon",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],r.prototype,"clickable",void 0),r=(0,s.Cg)([(0,n.EM)("integration-badge")],r)},35502(e,i,t){t.a(e,async function(e,s){try{t.r(i);t(44114),t(18111),t(22489),t(7588),t(61701),t(17642),t(58004),t(33853),t(45876),t(32475),t(15024),t(31698);var o=t(62826),n=t(5124),a=t(22441),r=t(36312),c=t(1087),d=t(52220),l=t(18350),h=t(77423),p=t(26571),g=t(95350),u=t(42262),_=t(54706),b=(t(73561),t(54819)),f=e([l]);l=(f.then?(await f)():f)[0];const m=new Set(["backup","google_translate","hassio","met","radio_browser","rpi_power","shopping_list","sun"]);class y extends((0,_.E)(n.WF)){hassSubscribe(){return[(0,p.x)(this.hass,e=>{e.forEach(e=>{"removed"===e.type||m.has(e.flow.handler)||this._discoveredDomains.add(e.flow.handler)}),this.hass.loadBackendTranslation("title",Array.from(this._discoveredDomains)),this._discoveredDomainsReceived=!0}),(0,h.TC)(this.hass,e=>{let i=!1;const t=[],s=new Set;if(e.forEach(e=>{if(null===e.type||"added"===e.type){if(m.has(e.entry.domain))return;t.push(e.entry),s.add(e.entry.domain),null===e.type&&(i=!0)}else if("removed"===e.type)this._entries=this._entries.filter(i=>i.entry_id!==e.entry.entry_id);else if("updated"===e.type){if(m.has(e.entry.domain))return;const i=e.entry;this._entries=this._entries.map(e=>e.entry_id===i.entry_id?i:e)}}),!t.length&&!i)return;this.hass.loadBackendTranslation("title",Array.from(s));const o=i?[]:this._entries;this._entries=[...o,...t]},{type:["device","hub","service"]})]}render(){if(!this._discoveredDomainsReceived)return n.s6;let e=new Set;this._entries.forEach(i=>{e.add(i.domain)}),e=new Set([...e,...this._discoveredDomains]);let i=[];for(const t of e.values())i.push([t,(0,g.p$)(this.hass.localize,t)]);i=i.sort((e,i)=>(0,d.xL)(e[0],i[0],this.hass.locale.language));const t=i.length;return 0===t?n.qy` <div class="all-set-icon">🎉</div> <h1> ${this.onboardingLocalize("ui.panel.page-onboarding.integration.all_set")} </h1> <p> ${this.onboardingLocalize("ui.panel.page-onboarding.integration.lets_start")} </p> <div class="footer"> <ha-button @click="${this._finish}"> ${this.onboardingLocalize("ui.panel.page-onboarding.integration.finish")} </ha-button> </div> `:(i.length>12&&(i=i.slice(0,11)),n.qy` <h1> ${this.onboardingLocalize("ui.panel.page-onboarding.integration.header")} </h1> <p> ${this.onboardingLocalize("ui.panel.page-onboarding.integration.intro")} </p> <div class="badges"> ${i.map(([e,i])=>n.qy`<integration-badge .domain="${e}" .title="${i}" .darkOptimizedIcon="${this.hass.themes?.darkMode}"></integration-badge>`)} ${t>i.length?n.qy`<div class="more"> ${this.onboardingLocalize("ui.panel.page-onboarding.integration.more_integrations",{count:t-i.length})} </div>`:n.s6} </div> <div class="footer"> <ha-button @click="${this._finish}"> ${this.onboardingLocalize("ui.panel.page-onboarding.integration.finish")} </ha-button> </div> `)}firstUpdated(e){super.firstUpdated(e),this.hass.loadBackendTranslation("title"),this._scanUSBDevices()}async _scanUSBDevices(){(0,r.x)(this.hass.config,"usb")&&await(0,u.$)(this.hass)}async _finish(){(0,c.r)(this,"onboarding-step",{type:"integration"})}static get styles(){return[b.o,n.AH`.badges{margin-top:24px;display:grid;grid-template-columns:repeat(auto-fill,minmax(106px,1fr));row-gap:var(--ha-space-6)}.more{display:flex;justify-content:center;align-items:center;height:100%}.all-set-icon{font-size:64px;text-align:center}`]}constructor(...e){super(...e),this._entries=[],this._discoveredDomains=new Set,this._discoveredDomainsReceived=!1}}(0,o.Cg)([(0,a.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],y.prototype,"onboardingLocalize",void 0),(0,o.Cg)([(0,a.wk)()],y.prototype,"_entries",void 0),(0,o.Cg)([(0,a.wk)()],y.prototype,"_discoveredDomains",void 0),(0,o.Cg)([(0,a.wk)()],y.prototype,"_discoveredDomainsReceived",void 0),y=(0,o.Cg)([(0,a.EM)("onboarding-integrations")],y),s()}catch(e){s(e)}})}};