iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 13.2 kB
JavaScript
export const __webpack_ids__=["8754"];export const __webpack_modules__={75011:function(e,t,n){n.d(t,{I:()=>r,k:()=>i});n(92519),n(42179),n(89256),n(24931),n(88463),n(57449),n(19814);const i=new Set(["primary","accent","disabled","red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","light-grey","grey","dark-grey","blue-grey","black","white"]);function r(e){return i.has(e)?`var(--${e}-color)`:e}},94947:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{G:()=>l});var r=n(16485),o=n(27486),a=n(27046),s=e([r,a]);[r,a]=s.then?(await s)():s;const u=(0,o.Z)((e=>new Intl.RelativeTimeFormat(e.language,{numeric:"auto"}))),l=(e,t,n,i=!0)=>{const r=(0,a.W)(e,n,t);return i?u(t).format(r.value,r.unit):Intl.NumberFormat(t.language,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(Math.abs(r.value))};i()}catch(e){i(e)}}))},31064:function(e,t,n){n.d(t,{T:()=>r});const i=/^(\w+)\.(\w+)$/,r=e=>i.test(e)},34618:function(e,t,n){n.d(t,{N:()=>i});const i=(e,t=2)=>Math.round(e*10**t)/10**t},27046:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{W:()=>c});var r=n(13809),o=n(29558),a=n(94763),s=n(19631);const u=1e3,l=60,d=60*l;function c(e,t=Date.now(),n,i={}){const c={...h,...i||{}},m=(+e-+t)/u;if(Math.abs(m)<c.second)return{value:Math.round(m),unit:"second"};const y=m/l;if(Math.abs(y)<c.minute)return{value:Math.round(y),unit:"minute"};const b=m/d;if(Math.abs(b)<c.hour)return{value:Math.round(b),unit:"hour"};const g=new Date(e),f=new Date(t);g.setHours(0,0,0,0),f.setHours(0,0,0,0);const p=(0,r.j)(g,f);if(0===p)return{value:Math.round(b),unit:"hour"};if(Math.abs(p)<c.day)return{value:p,unit:"day"};const v=(0,s.Bt)(n),k=(0,o.z)(g,{weekStartsOn:v}),w=(0,o.z)(f,{weekStartsOn:v}),_=(0,a.p)(k,w);if(0===_)return{value:p,unit:"day"};if(Math.abs(_)<c.week)return{value:_,unit:"week"};const C=g.getFullYear()-f.getFullYear(),E=12*C+g.getMonth()-f.getMonth();return 0===E?{value:_,unit:"week"}:Math.abs(E)<c.month||0===C?{value:E,unit:"month"}:{value:Math.round(C),unit:"year"}}const h={second:45,minute:45,hour:22,day:5,week:4,month:11};i()}catch(m){i(m)}}))},34273:function(e,t,n){var i=n(44249),r=n(72621),o=(n(9359),n(31526),n(22997),n(57243)),a=n(15093),s=n(5111),u=n(76525);(0,i.Z)([(0,a.Mo)("ha-button-menu")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",key:u.gA,value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"corner",value:()=>"BOTTOM_START"},{kind:"field",decorators:[(0,a.Cb)({attribute:"menu-corner"})],key:"menuCorner",value:()=>"START"},{kind:"field",decorators:[(0,a.Cb)({type:Number})],key:"x",value:()=>null},{kind:"field",decorators:[(0,a.Cb)({type:Number})],key:"y",value:()=>null},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"multi",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"activatable",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"fixed",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)({type:Boolean,attribute:"no-anchor"})],key:"noAnchor",value:()=>!1},{kind:"field",decorators:[(0,a.IO)("mwc-menu",!0)],key:"_menu",value:void 0},{kind:"get",key:"items",value:function(){return this._menu?.items}},{kind:"get",key:"selected",value:function(){return this._menu?.selected}},{kind:"method",key:"focus",value:function(){this._menu?.open?this._menu.focusItemAtIndex(0):this._triggerButton?.focus()}},{kind:"method",key:"render",value:function(){return o.dy` <div @click="${this._handleClick}"> <slot name="trigger" @slotchange="${this._setTriggerAria}"></slot> </div> <mwc-menu .corner="${this.corner}" .menuCorner="${this.menuCorner}" .fixed="${this.fixed}" .multi="${this.multi}" .activatable="${this.activatable}" .y="${this.y}" .x="${this.x}"> <slot></slot> </mwc-menu> `}},{kind:"method",key:"firstUpdated",value:function(e){(0,r.Z)(n,"firstUpdated",this,3)([e]),"rtl"===s.E.document.dir&&this.updateComplete.then((()=>{this.querySelectorAll("mwc-list-item").forEach((e=>{const t=document.createElement("style");t.innerHTML="span.material-icons:first-of-type { margin-left: var(--mdc-list-item-graphic-margin, 32px) !important; margin-right: 0px !important;}",e.shadowRoot.appendChild(t)}))}))}},{kind:"method",key:"_handleClick",value:function(){this.disabled||(this._menu.anchor=this.noAnchor?null:this,this._menu.show())}},{kind:"get",key:"_triggerButton",value:function(){return this.querySelector('ha-icon-button[slot="trigger"], mwc-button[slot="trigger"]')}},{kind:"method",key:"_setTriggerAria",value:function(){this._triggerButton&&(this._triggerButton.ariaHasPopup="menu")}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{display:inline-block;position:relative}::slotted([disabled]){color:var(--disabled-text-color)}`}]}}),o.oi)},51223:function(e,t,n){n.a(e,(async function(e,t){try{var i=n(44249),r=n(57243),o=n(15093),a=n(94571),s=n(59847),u=n(45729),l=(n(65981),n(37583),e([u]));u=(l.then?(await l)():l)[0];(0,i.Z)([(0,o.Mo)("ha-state-icon")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"stateValue",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"icon",value:void 0},{kind:"method",key:"render",value:function(){const e=this.icon||this.stateObj&&this.hass?.entities[this.stateObj.entity_id]?.icon||this.stateObj?.attributes.icon;if(e)return r.dy`<ha-icon .icon="${e}"></ha-icon>`;if(!this.stateObj)return r.Ld;if(!this.hass)return this._renderFallback();const t=(0,u.gD)(this.hass,this.stateObj,this.stateValue).then((e=>e?r.dy`<ha-icon .icon="${e}"></ha-icon>`:this._renderFallback()));return r.dy`${(0,a.C)(t)}`}},{kind:"method",key:"_renderFallback",value:function(){const e=(0,s.N)(this.stateObj);return r.dy` <ha-svg-icon .path="${u.Ls[e]||u.Rb}"></ha-svg-icon> `}}]}}),r.oi);t()}catch(e){t(e)}}))},96194:function(e,t,n){n.d(t,{ON:()=>a,PX:()=>s,V_:()=>u,lz:()=>o,nZ:()=>r,rk:()=>d});var i=n(92636);const r="unavailable",o="unknown",a="on",s="off",u=[r,o],l=[r,o,s],d=(0,i.z)(u);(0,i.z)(l)},40249:function(e,t,n){n.d(t,{ED:()=>h,Fr:()=>a,N2:()=>o,Tw:()=>d,Xm:()=>c});var i=n(36522),r=n(17951);const o=(e,t)=>({type:"error",error:e,origConfig:t}),a=(e,t)=>({type:"error",error:e,origConfig:t}),s=(e,t)=>{const n=document.createElement(e);return n.setConfig(t),n},u=(e,t,i)=>"badge"===e?(e=>{const t=document.createElement("hui-error-badge");return customElements.get("hui-error-badge")?t.setConfig(e):(Promise.all([n.e("35671"),n.e("83895"),n.e("8795"),n.e("32146"),n.e("7068"),n.e("46972"),n.e("63055"),n.e("52358"),n.e("79931"),n.e("44251"),n.e("65005"),n.e("60487"),n.e("3371"),n.e("92691"),n.e("38326"),n.e("10745"),n.e("70639"),n.e("72974"),n.e("29354"),n.e("56766")]).then(n.bind(n,72814)),customElements.whenDefined("hui-error-badge").then((()=>{customElements.upgrade(t),t.setConfig(e)}))),t})(a(t,i)):"heading-badge"===e?(e=>{const t=document.createElement("hui-error-heading-badge");return customElements.get("hui-error-heading-badge")?t.setConfig(e):(Promise.all([n.e("35671"),n.e("83895"),n.e("8795"),n.e("32146"),n.e("7068"),n.e("69127"),n.e("63055"),n.e("52358"),n.e("79931"),n.e("44251"),n.e("65005"),n.e("60487"),n.e("3371"),n.e("92691"),n.e("38326"),n.e("10745"),n.e("70639"),n.e("72974"),n.e("29354"),n.e("95016")]).then(n.bind(n,5031)),customElements.whenDefined("hui-error-heading-badge").then((()=>{customElements.upgrade(t),t.setConfig(e)}))),t})(((e,t)=>({type:"error",error:e,origConfig:t}))(t,i)):(e=>{const t=document.createElement("hui-error-card");return customElements.get("hui-error-card")?t.setConfig(e):(Promise.all([n.e("83895"),n.e("8795"),n.e("91382")]).then(n.bind(n,53257)),customElements.whenDefined("hui-error-card").then((()=>{customElements.upgrade(t),t.setConfig(e)}))),t})(o(t,i)),l=e=>(0,r.IT)(e)?(0,r.V0)(e):void 0,d=(e,t,n,i,r,o)=>{try{return c(e,t,n,i,r,o)}catch(n){return console.error(e,t.type,n),u(e,n.message,t)}},c=(e,t,n,r,o,a)=>{if(!t||"object"!=typeof t)throw new Error("Config is not an object");if(!(t.type||a||o&&"entity"in t))throw new Error("No card type configured");const d=t.type?l(t.type):void 0;if(d)return((e,t,n)=>{if(customElements.get(t))return s(t,n);const r=u(e,`Custom element doesn't exist: ${t}.`,n);if(!t.includes("-"))return r;r.style.display="None";const o=window.setTimeout((()=>{r.style.display=""}),2e3);return customElements.whenDefined(t).then((()=>{clearTimeout(o),(0,i.B)(r,"ll-rebuild")})),r})(e,d,t);let c;if(o&&!t.type&&t.entity){c=`${o[t.entity.split(".",1)[0]]||o._domain_not_found}-entity`}else c=t.type||a;if(void 0===c)throw new Error("No type specified");const h=`hui-${c}-${e}`;if(r&&c in r)return r[c](),((e,t)=>{if(customElements.get(e))return s(e,t);const n=document.createElement(e);return customElements.whenDefined(e).then((()=>{try{customElements.upgrade(n),(0,i.B)(n,"ll-upgrade"),n.setConfig(t)}catch(e){(0,i.B)(n,"ll-rebuild")}})),n})(h,t);if(n&&n.has(c))return s(h,t);throw new Error(`Unknown type encountered: ${c}`)},h=async(e,t,n,i)=>{const r=l(e);if(r){const e=customElements.get(r);if(e)return e;if(!r.includes("-"))throw new Error(`Custom element not found: ${r}`);return new Promise(((e,t)=>{setTimeout((()=>t(new Error(`Custom element not found: ${r}`))),2e3),customElements.whenDefined(r).then((()=>e(customElements.get(r))))}))}const o=`hui-${e}-${t}`,a=customElements.get(o);if(n&&n.has(e))return a;if(i&&e in i)return a||i[e]().then((()=>customElements.get(o)));throw new Error(`Unknown type: ${e}`)}},46542:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{T:()=>k,m:()=>v});n(92519),n(42179),n(89256),n(24931),n(88463),n(57449),n(19814);var r=n(72053),o=n(35659),a=n(52809),s=n(40165),u=n(82114),l=n(21474),d=n(31087),c=n(90296),h=n(42135),m=n(40806),y=n(40249),b=e([r,o,a,s,u,l,d,c,h,m]);[r,o,a,s,u,l,d,c,h,m]=b.then?(await b)():b;const g=new Set(["media-player-entity","scene-entity","script-entity","sensor-entity","simple-entity","toggle-entity","button","call-service"]),f={"button-entity":()=>n.e("44821").then(n.bind(n,35154)),"climate-entity":()=>n.e("79702").then(n.bind(n,54222)),"cover-entity":()=>n.e("50764").then(n.bind(n,4806)),"date-entity":()=>Promise.all([n.e("46379"),n.e("50013")]).then(n.bind(n,61351)),"datetime-entity":()=>Promise.all([n.e("46379"),n.e("41258"),n.e("35671"),n.e("3134"),n.e("3561"),n.e("37311")]).then(n.bind(n,67429)),"event-entity":()=>Promise.resolve().then(n.bind(n,72053)),"group-entity":()=>n.e("83537").then(n.bind(n,40445)),"input-button-entity":()=>n.e("5380").then(n.bind(n,57548)),"humidifier-entity":()=>n.e("84999").then(n.bind(n,88916)),"input-datetime-entity":()=>Promise.all([n.e("46379"),n.e("41258"),n.e("35671"),n.e("3561"),n.e("88438")]).then(n.bind(n,67223)),"input-number-entity":()=>Promise.all([n.e("46379"),n.e("84605")]).then(n.bind(n,90516)),"input-select-entity":()=>Promise.all([n.e("41258"),n.e("35671"),n.e("66868")]).then(n.bind(n,43)),"input-text-entity":()=>Promise.all([n.e("46379"),n.e("14673")]).then(n.bind(n,22623)),"lock-entity":()=>n.e("99689").then(n.bind(n,65751)),"number-entity":()=>Promise.all([n.e("46379"),n.e("88187")]).then(n.bind(n,77288)),"select-entity":()=>Promise.all([n.e("41258"),n.e("35671"),n.e("86857")]).then(n.bind(n,64827)),"text-entity":()=>Promise.all([n.e("46379"),n.e("86449")]).then(n.bind(n,90689)),"time-entity":()=>Promise.all([n.e("46379"),n.e("41258"),n.e("35671"),n.e("3561"),n.e("46309")]).then(n.bind(n,4671)),"timer-entity":()=>n.e("7618").then(n.bind(n,45363)),"update-entity":()=>n.e("58400").then(n.bind(n,97604)),"valve-entity":()=>n.e("96347").then(n.bind(n,97937)),conditional:()=>n.e("79220").then(n.bind(n,24272)),"weather-entity":()=>Promise.all([n.e("44251"),n.e("28565")]).then(n.bind(n,51973)),divider:()=>n.e("73576").then(n.bind(n,70568)),section:()=>n.e("26438").then(n.bind(n,93665)),weblink:()=>n.e("41871").then(n.bind(n,69819)),cast:()=>n.e("45006").then(n.bind(n,15638)),buttons:()=>Promise.all([n.e("59821"),n.e("73644")]).then(n.bind(n,58574)),attribute:()=>Promise.resolve().then(n.bind(n,90296)),text:()=>n.e("52767").then(n.bind(n,68291))},p={_domain_not_found:"simple",alert:"toggle",automation:"toggle",button:"button",climate:"climate",cover:"cover",date:"date",datetime:"datetime",event:"event",fan:"toggle",group:"group",humidifier:"humidifier",input_boolean:"toggle",input_button:"input-button",input_datetime:"input-datetime",input_number:"input-number",input_select:"input-select",input_text:"input-text",light:"toggle",lock:"lock",media_player:"media-player",number:"number",remote:"toggle",scene:"scene",script:"script",select:"select",sensor:"sensor",siren:"toggle",switch:"toggle",text:"text",time:"time",timer:"timer",update:"update",vacuum:"toggle",valve:"valve",water_heater:"climate",weather:"weather"},v=e=>(0,y.Tw)("row",e,g,f,p,void 0),k=e=>(0,y.ED)(e,"row",g,f);i()}catch(e){i(e)}}))}};
//# sourceMappingURL=8754.83f9d2d868c0201c.js.map