iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 15.3 kB
JavaScript
export const __webpack_ids__=["71683"];export const __webpack_modules__={29095:function(e,t,r){r.a(e,(async function(e,t){try{var i=r(44249),n=r(57243),s=r(15093),o=(r(59826),r(17170)),a=(r(37583),e([o]));o=(a.then?(await a)():a)[0];const c="M2.2,16.06L3.88,12L2.2,7.94L6.26,6.26L7.94,2.2L12,3.88L16.06,2.2L17.74,6.26L21.8,7.94L20.12,12L21.8,16.06L17.74,17.74L16.06,21.8L12,20.12L7.94,21.8L6.26,17.74L2.2,16.06M13,17V15H11V17H13M13,13V7H11V13H13Z",l="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z";(0,i.Z)([(0,s.Mo)("ha-progress-button")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"progress",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"raised",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"unelevated",value:()=>!1},{kind:"field",decorators:[(0,s.SB)()],key:"_result",value:void 0},{kind:"method",key:"render",value:function(){const e=this._result||this.progress;return n.dy` <ha-button .raised="${this.raised}" .label="${this.label}" .unelevated="${this.unelevated}" .disabled="${this.disabled||this.progress}" class="${this._result||""}"> <slot name="icon" slot="icon"></slot> <slot></slot> </ha-button> ${e?n.dy` <div class="progress"> ${"success"===this._result?n.dy`<ha-svg-icon .path="${l}"></ha-svg-icon>`:"error"===this._result?n.dy`<ha-svg-icon .path="${c}"></ha-svg-icon>`:this.progress?n.dy`<ha-spinner size="small"></ha-spinner>`:n.Ld} </div> `:n.Ld} `}},{kind:"method",key:"actionSuccess",value:function(){this._setResult("success")}},{kind:"method",key:"actionError",value:function(){this._setResult("error")}},{kind:"method",key:"_setResult",value:function(e){this._result=e,setTimeout((()=>{this._result=void 0}),2e3)}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`:host{outline:0;display:inline-block;position:relative;pointer-events:none}ha-button{transition:all 1s;pointer-events:initial}ha-button.success{--mdc-theme-primary:white;background-color:var(--success-color);transition:none;border-radius:4px;pointer-events:none}ha-button[raised].success,ha-button[unelevated].success{--mdc-theme-primary:var(--success-color);--mdc-theme-on-primary:white}ha-button.error{--mdc-theme-primary:white;background-color:var(--error-color);transition:none;border-radius:4px;pointer-events:none}ha-button[raised].error,ha-button[unelevated].error{--mdc-theme-primary:var(--error-color);--mdc-theme-on-primary:white}.progress{bottom:4px;position:absolute;text-align:center;top:4px;width:100%}ha-svg-icon{color:#fff}ha-button.error slot,ha-button.success slot{visibility:hidden}:host([destructive]){--mdc-theme-primary:var(--error-color)}`}]}}),n.oi);t()}catch(e){t(e)}}))},17170:function(e,t,r){r.a(e,(async function(e,i){try{r.r(t),r.d(t,{HaSpinner:()=>h});var n=r(44249),s=r(72621),o=r(97677),a=r(43580),c=r(57243),l=r(15093),d=e([o]);o=(d.then?(await d)():d)[0];let h=(0,n.Z)([(0,l.Mo)("ha-spinner")],(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"field",decorators:[(0,l.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(e){if((0,s.Z)(r,"updated",this,3)([e]),e.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-spinner-size","16px");break;case"small":this.style.setProperty("--ha-spinner-size","28px");break;case"medium":this.style.setProperty("--ha-spinner-size","48px");break;case"large":this.style.setProperty("--ha-spinner-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}},{kind:"field",static:!0,key:"styles",value:()=>[a.Z,c.iv`:host{--indicator-color:var(
--ha-spinner-indicator-color,
var(--primary-color)
);--track-color:var(--ha-spinner-divider-color, var(--divider-color));--track-width:4px;--speed:3.5s;font-size:var(--ha-spinner-size, 48px)}`]}]}}),o.Z);i()}catch(e){i(e)}}))},31221:function(e,t,r){r.a(e,(async function(e,i){try{r.r(t);var n=r(44249),s=r(72621),o=(r(9359),r(70104),r(57243)),a=r(15093),c=r(82393),l=r(73850),d=(r(54977),r(72099)),h=r(69223),u=r(44804),m=e([u]);u=(m.then?(await m)():m)[0];(0,n.Z)([(0,a.Mo)("hui-picture-elements-card")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"method",static:!0,key:"getConfigElement",value:async function(){return await Promise.all([r.e("41258"),r.e("95444"),r.e("37008"),r.e("500")]).then(r.bind(r,47273)),document.createElement("hui-picture-elements-card-editor")}},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_elements",value:void 0},{kind:"method",static:!0,key:"getStubConfig",value:function(e,t,r){return{type:"picture-elements",elements:[{type:"state-badge",entity:(0,h.j)(e,1,t,r,["sensor","binary_sensor"])[0]||"",style:{top:"32%",left:"40%"}}],image:"https://demo.home-assistant.io/stub_config/floorplan.png"}}},{kind:"field",decorators:[(0,a.SB)()],key:"_config",value:void 0},{kind:"method",key:"getCardSize",value:function(){return 4}},{kind:"method",key:"setConfig",value:function(e){if(!e)throw new Error("Invalid configuration");if(!(e.image||e.image_entity||e.camera_image||e.state_image)||e.state_image&&!e.entity)throw new Error("Image required");if(!Array.isArray(e.elements))throw new Error("Elements required");this._config=e,this._elements=e.elements.map((e=>this._createElement(e)))}},{kind:"method",key:"updated",value:function(e){if((0,s.Z)(i,"updated",this,3)([e]),!this._config||!this.hass)return;if(this._elements&&e.has("hass"))for(const e of this._elements)e.hass=this.hass;const t=e.get("hass"),r=e.get("_config");t&&r&&t.themes===this.hass.themes&&r.theme===this._config.theme||(0,c.R)(this,this.hass.themes,this._config.theme)}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return o.Ld;let e=this._config.image;if(this._config.image_entity){const t=this.hass.states[this._config.image_entity];switch((0,l.M)(this._config.image_entity)){case"image":e=(0,d.U)(t);break;case"person":t.attributes.entity_picture&&(e=t.attributes.entity_picture)}}return o.dy` <ha-card .header="${this._config.title}"> <div id="root"> <hui-image .hass="${this.hass}" .image="${e}" .stateImage="${this._config.state_image}" .stateFilter="${this._config.state_filter}" .cameraImage="${this._config.camera_image}" .cameraView="${this._config.camera_view}" .entity="${this._config.entity}" .aspectRatio="${this._config.aspect_ratio}" .darkModeFilter="${this._config.dark_mode_filter}" .darkModeImage="${this._config.dark_mode_image}"></hui-image> ${this._elements} </div> </ha-card> `}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`#root{position:relative}.element{position:absolute;transform:translate(-50%,-50%)}ha-card{overflow:hidden;height:100%;box-sizing:border-box}`},{kind:"method",key:"_createElement",value:function(e){const t=(0,u.O)(e);return this.hass&&(t.hass=this.hass),t.addEventListener("ll-rebuild",(r=>{r.stopPropagation(),this._rebuildElement(t,e)}),{once:!0}),t}},{kind:"method",key:"_rebuildElement",value:function(e,t){const r=this._createElement(t);e.parentElement&&e.parentElement.replaceChild(r,e),this._elements=this._elements.map((t=>t===e?r:t))}}]}}),o.oi);i()}catch(e){i(e)}}))},52032:function(e,t,r){r.a(e,(async function(e,i){try{r.d(t,{w:()=>u});r(92519),r(42179),r(89256),r(24931),r(88463),r(57449),r(19814);var n=r(35729),s=(r(83442),r(92263)),o=r(15367),a=r(56332),c=r(13888),l=(r(9427),r(40249)),d=e([n,s,o,a,c]);[n,s,o,a,c]=d.then?(await d)():d;const h=new Set(["conditional","icon","image","service-button","state-badge","state-icon","state-label"]),u=e=>("action-button"===e.type&&(e={...e,type:"service-button"}),(0,l.Tw)("element",e,h));i()}catch(e){i(e)}}))},48734:function(e,t,r){r.a(e,(async function(e,i){try{r.d(t,{P5:()=>u,Ve:()=>p});var n=r(16485),s=(r(9359),r(70104),r(92519),r(42179),r(89256),r(24931),r(88463),r(57449),r(19814),e([n]));n=(s.then?(await s)():s)[0];const o=new Set,a=new Map;let c,l="ltr",d="en";const h="undefined"!=typeof MutationObserver&&"undefined"!=typeof document&&void 0!==document.documentElement;if(h){const f=new MutationObserver(m);l=document.documentElement.dir||"ltr",d=document.documentElement.lang||navigator.language,f.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","lang"]})}function u(...e){e.map((e=>{const t=e.$code.toLowerCase();a.has(t)?a.set(t,Object.assign(Object.assign({},a.get(t)),e)):a.set(t,e),c||(c=e)})),m()}function m(){h&&(l=document.documentElement.dir||"ltr",d=document.documentElement.lang||navigator.language),[...o.keys()].map((e=>{"function"==typeof e.requestUpdate&&e.requestUpdate()}))}class p{constructor(e){this.host=e,this.host.addController(this)}hostConnected(){o.add(this.host)}hostDisconnected(){o.delete(this.host)}dir(){return`${this.host.dir||l}`.toLowerCase()}lang(){return`${this.host.lang||d}`.toLowerCase()}getTranslationData(e){var t,r;const i=new Intl.Locale(e.replace(/_/g,"-")),n=null==i?void 0:i.language.toLowerCase(),s=null!==(r=null===(t=null==i?void 0:i.region)||void 0===t?void 0:t.toLowerCase())&&void 0!==r?r:"";return{locale:i,language:n,region:s,primary:a.get(`${n}-${s}`),secondary:a.get(n)}}exists(e,t){var r;const{primary:i,secondary:n}=this.getTranslationData(null!==(r=t.lang)&&void 0!==r?r:this.lang());return t=Object.assign({includeFallback:!1},t),!!(i&&i[e]||n&&n[e]||t.includeFallback&&c&&c[e])}term(e,...t){const{primary:r,secondary:i}=this.getTranslationData(this.lang());let n;if(r&&r[e])n=r[e];else if(i&&i[e])n=i[e];else{if(!c||!c[e])return console.error(`No translation found for: ${String(e)}`),String(e);n=c[e]}return"function"==typeof n?n(...t):n}date(e,t){return e=new Date(e),new Intl.DateTimeFormat(this.lang(),t).format(e)}number(e,t){return e=Number(e),isNaN(e)?"":new Intl.NumberFormat(this.lang(),t).format(e)}relativeTime(e,t,r){return new Intl.RelativeTimeFormat(this.lang(),r).format(e,t)}}i()}catch(g){i(g)}}))},68783:function(e,t,r){r.a(e,(async function(e,i){try{r.d(t,{A:()=>d});var n=r(64699),s=r(15073),o=r(81048),a=r(31027),c=r(57243),l=e([s]);s=(l.then?(await l)():l)[0];var d=class extends a.P{constructor(){super(...arguments),this.localize=new s.V(this)}render(){return c.dy` <svg part="base" class="spinner" role="progressbar" aria-label="${this.localize.term("loading")}"> <circle class="spinner__track"></circle> <circle class="spinner__indicator"></circle> </svg> `}};d.styles=[o.N,n.D],i()}catch(e){i(e)}}))},31027:function(e,t,r){r.d(t,{P:()=>a});r(9359),r(31526);var i,n=r(52812),s=r(57243),o=r(15093),a=class extends s.oi{constructor(){super(),(0,n.Ko)(this,i,!1),this.initialReflectedProperties=new Map,Object.entries(this.constructor.dependencies).forEach((([e,t])=>{this.constructor.define(e,t)}))}emit(e,t){const r=new CustomEvent(e,(0,n.ih)({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(r),r}static define(e,t=this,r={}){const i=customElements.get(e);if(!i){try{customElements.define(e,t,r)}catch(i){customElements.define(e,class extends t{},r)}return}let n=" (unknown version)",s=n;"version"in t&&t.version&&(n=" v"+t.version),"version"in i&&i.version&&(s=" v"+i.version),n&&s&&n===s||console.warn(`Attempted to register <${e}>${n}, but <${e}>${s} has already been registered.`)}attributeChangedCallback(e,t,r){(0,n.ac)(this,i)||(this.constructor.elementProperties.forEach(((e,t)=>{e.reflect&&null!=this[t]&&this.initialReflectedProperties.set(t,this[t])})),(0,n.qx)(this,i,!0)),super.attributeChangedCallback(e,t,r)}willUpdate(e){super.willUpdate(e),this.initialReflectedProperties.forEach(((t,r)=>{e.has(r)&&null==this[r]&&(this[r]=t)}))}};i=new WeakMap,a.version="2.20.1",a.dependencies={},(0,n.u2)([(0,o.Cb)()],a.prototype,"dir",2),(0,n.u2)([(0,o.Cb)()],a.prototype,"lang",2)},15073:function(e,t,r){r.a(e,(async function(e,i){try{r.d(t,{V:()=>a});var n=r(21262),s=r(48734),o=e([s,n]);[s,n]=o.then?(await o)():o;var a=class extends s.Ve{};(0,s.P5)(n.K),i()}catch(e){i(e)}}))},21262:function(e,t,r){r.a(e,(async function(e,i){try{r.d(t,{K:()=>a});var n=r(48734),s=e([n]);n=(s.then?(await s)():s)[0];var o={$code:"en",$name:"English",$dir:"ltr",carousel:"Carousel",clearEntry:"Clear entry",close:"Close",copied:"Copied",copy:"Copy",currentValue:"Current value",error:"Error",goToSlide:(e,t)=>`Go to slide ${e} of ${t}`,hidePassword:"Hide password",loading:"Loading",nextSlide:"Next slide",numOptionsSelected:e=>0===e?"No options selected":1===e?"1 option selected":`${e} options selected`,previousSlide:"Previous slide",progress:"Progress",remove:"Remove",resize:"Resize",scrollToEnd:"Scroll to end",scrollToStart:"Scroll to start",selectAColorFromTheScreen:"Select a color from the screen",showPassword:"Show password",slideNum:e=>`Slide ${e}`,toggleColorFormat:"Toggle color format"};(0,n.P5)(o);var a=o;i()}catch(e){i(e)}}))},64699:function(e,t,r){r.d(t,{D:()=>i});var i=r(57243).iv`:host{--track-width:2px;--track-color:rgb(128 128 128 / 25%);--indicator-color:var(--sl-color-primary-600);--speed:2s;display:inline-flex;width:1em;height:1em;flex:none}.spinner{flex:1 1 auto;height:100%;width:100%}.spinner__indicator,.spinner__track{fill:none;stroke-width:var(--track-width);r:calc(0.5em - var(--track-width)/ 2);cx:0.5em;cy:0.5em;transform-origin:50% 50%}.spinner__track{stroke:var(--track-color);transform-origin:0% 0%}.spinner__indicator{stroke:var(--indicator-color);stroke-linecap:round;stroke-dasharray:150% 75%;animation:spin var(--speed) linear infinite}@keyframes spin{0%{transform:rotate(0deg);stroke-dasharray:0.05em,3em}50%{transform:rotate(450deg);stroke-dasharray:1.375em,1.375em}100%{transform:rotate(1080deg);stroke-dasharray:0.05em,3em}}`},52812:function(e,t,r){r.d(t,{EZ:()=>m,Ko:()=>v,ac:()=>g,ih:()=>u,qx:()=>y,u2:()=>p});var i=Object.defineProperty,n=Object.defineProperties,s=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,d=e=>{throw TypeError(e)},h=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u=(e,t)=>{for(var r in t||(t={}))c.call(t,r)&&h(e,r,t[r]);if(a)for(var r of a(t))l.call(t,r)&&h(e,r,t[r]);return e},m=(e,t)=>n(e,o(t)),p=(e,t,r,n)=>{for(var o,a=n>1?void 0:n?s(t,r):t,c=e.length-1;c>=0;c--)(o=e[c])&&(a=(n?o(t,r,a):o(a))||a);return n&&a&&i(t,r,a),a},f=(e,t,r)=>t.has(e)||d("Cannot "+r),g=(e,t,r)=>(f(e,t,"read from private field"),r?r.call(e):t.get(e)),v=(e,t,r)=>t.has(e)?d("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),y=(e,t,r,i)=>(f(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r)},81048:function(e,t,r){r.d(t,{N:()=>i});var i=r(57243).iv`:host{box-sizing:border-box}:host *,:host ::after,:host ::before{box-sizing:inherit}[hidden]{display:none!important}`},97677:function(e,t,r){r.a(e,(async function(e,i){try{r.d(t,{Z:()=>n.A});var n=r(68783),s=(r(64699),r(15073)),o=r(21262),a=(r(81048),r(31027),r(52812),e([s,o,n]));[s,o,n]=a.then?(await a)():a,i()}catch(e){i(e)}}))},43580:function(e,t,r){r.d(t,{Z:()=>i.D});var i=r(64699);r(52812)}};
//# sourceMappingURL=71683.8f5ea111983e4eb6.js.map