UNPKG

iobroker.lovelace

Version:

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

1 lines 14.1 kB
export const __rspack_esm_id=91845;export const __rspack_esm_ids=[91845];export const __webpack_modules__={18997(t,e,i){var a=i(62826),s=i(5124),r=i(22441),o=i(6412),n=i(44144);class l extends s.WF{willUpdate(t){super.willUpdate(t),t.has("url")&&this._resolve()}async _resolve(){if(this._small=!1,this._brand=!!this.url&&(0,n.bg)(this.url),!this.url)return void(this._resolvedUrl=void 0);const t=this.url;try{const a=await(e=this.hass,i=t,(0,n.bg)(i)?Promise.resolve((0,n.MR)({domain:(0,n.a_)(i),type:"icon",darkOptimized:e.themes?.darkMode},e.auth.data.hassUrl)):i.startsWith("/")?e.fetchWithAuth(i).then(t=>t.blob()).then(t=>new Promise((e,i)=>{const a=new FileReader;a.onload=()=>e("string"==typeof a.result?a.result:""),a.onerror=t=>i(t),a.readAsDataURL(t)})):Promise.resolve(i));if(t!==this.url)return;this._resolvedUrl=a,this._probeSize(a)}catch(e){t===this.url&&(this._resolvedUrl=void 0)}var e,i}_probeSize(t){if(this.url&&(0,n.bg)(this.url))return;if((t=>/\.svg(\?|#|$)/i.test(t)||t.startsWith("data:image/svg+xml"))(t))return;const e=new Image;e.addEventListener("load",()=>{this._resolvedUrl===t&&e.naturalWidth>0&&e.naturalWidth<=16&&(this._small=!0)}),e.src=t}render(){return this._resolvedUrl?s.qy` <div class="${(0,o.H)({image:!0,small:this._small,brand:this._brand})}" style="background-image:url(${this._resolvedUrl})"></div> `:s.s6}constructor(...t){super(...t),this._small=!1,this._brand=!1}}l.styles=s.AH`:host{display:block;width:100%;height:100%}.image{width:100%;height:100%;background-size:var(--ha-media-browser-thumbnail-fit,contain);background-repeat:no-repeat;background-position:center}.image.brand{background-size:40%}.image.small{image-rendering:pixelated}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)()],l.prototype,"url",void 0),(0,a.Cg)([(0,r.wk)()],l.prototype,"_resolvedUrl",void 0),(0,a.Cg)([(0,r.wk)()],l.prototype,"_small",void 0),(0,a.Cg)([(0,r.wk)()],l.prototype,"_brand",void 0),l=(0,a.Cg)([(0,r.EM)("ha-media-browser-thumbnail")],l)},53072(t,e,i){i.d(e,{$6:()=>H,EC:()=>V,ET:()=>A,H1:()=>L,HN:()=>m,Im:()=>E,QI:()=>g,Un:()=>M,Xm:()=>h,ce:()=>y,fh:()=>v,ie:()=>b,mm:()=>p,vj:()=>c});i(44114);var a=i(47129),s=i(82286),r=i(22675),o=i(52069);const n="M11,14C12,14 13.05,14.16 14.2,14.44C13.39,15.31 13,16.33 13,17.5C13,18.39 13.25,19.23 13.78,20H3V18C3,16.81 3.91,15.85 5.74,15.12C7.57,14.38 9.33,14 11,14M11,12C9.92,12 9,11.61 8.18,10.83C7.38,10.05 7,9.11 7,8C7,6.92 7.38,6 8.18,5.18C9,4.38 9.92,4 11,4C12.11,4 13.05,4.38 13.83,5.18C14.61,6 15,6.92 15,8C15,9.11 14.61,10.05 13.83,10.83C13.05,11.61 12.11,12 11,12M18.5,10H20L22,10V12H20V17.5A2.5,2.5 0 0,1 17.5,20A2.5,2.5 0 0,1 15,17.5A2.5,2.5 0 0,1 17.5,15C17.86,15 18.19,15.07 18.5,15.21V10Z",l="M14,19H18V5H14M6,19H10V5H6V19Z",_="M8,5.14V19.14L19,12.14L8,5.14Z",d="M13,3H11V13H13V3M17.83,5.17L16.41,6.59C18.05,7.91 19,9.9 19,12A7,7 0 0,1 12,19C8.14,19 5,15.88 5,12C5,9.91 5.95,7.91 7.58,6.58L6.17,5.17C2.38,8.39 1.92,14.07 5.14,17.86C8.36,21.64 14.04,22.1 17.83,18.88C19.85,17.17 21,14.65 21,12C21,9.37 19.84,6.87 17.83,5.17Z",u="M18,18H6V6H18V18Z",C="M8.16,3L6.75,4.41L9.34,7H4C2.89,7 2,7.89 2,9V19C2,20.11 2.89,21 4,21H20C21.11,21 22,20.11 22,19V9C22,7.89 21.11,7 20,7H14.66L17.25,4.41L15.84,3L12,6.84L8.16,3M4,9H17V19H4V9M19.5,9A1,1 0 0,1 20.5,10A1,1 0 0,1 19.5,11A1,1 0 0,1 18.5,10A1,1 0 0,1 19.5,9M19.5,12A1,1 0 0,1 20.5,13A1,1 0 0,1 19.5,14A1,1 0 0,1 18.5,13A1,1 0 0,1 19.5,12Z";var c=function(t){return t[t.PAUSE=1]="PAUSE",t[t.SEEK=2]="SEEK",t[t.VOLUME_SET=4]="VOLUME_SET",t[t.VOLUME_MUTE=8]="VOLUME_MUTE",t[t.PREVIOUS_TRACK=16]="PREVIOUS_TRACK",t[t.NEXT_TRACK=32]="NEXT_TRACK",t[t.TURN_ON=128]="TURN_ON",t[t.TURN_OFF=256]="TURN_OFF",t[t.PLAY_MEDIA=512]="PLAY_MEDIA",t[t.VOLUME_STEP=1024]="VOLUME_STEP",t[t.SELECT_SOURCE=2048]="SELECT_SOURCE",t[t.STOP=4096]="STOP",t[t.CLEAR_PLAYLIST=8192]="CLEAR_PLAYLIST",t[t.PLAY=16384]="PLAY",t[t.SHUFFLE_SET=32768]="SHUFFLE_SET",t[t.SELECT_SOUND_MODE=65536]="SELECT_SOUND_MODE",t[t.BROWSE_MEDIA=131072]="BROWSE_MEDIA",t[t.REPEAT_SET=262144]="REPEAT_SET",t[t.GROUPING=524288]="GROUPING",t}({});const L="browser",V={album:{icon:"M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11M12,16.5C9.5,16.5 7.5,14.5 7.5,12C7.5,9.5 9.5,7.5 12,7.5C14.5,7.5 16.5,9.5 16.5,12C16.5,14.5 14.5,16.5 12,16.5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",layout:"grid"},app:{icon:"M21 2H3C1.9 2 1 2.9 1 4V20C1 21.1 1.9 22 3 22H21C22.1 22 23 21.1 23 20V4C23 2.9 22.1 2 21 2M21 7H3V4H21V7Z",layout:"grid",show_list_images:!0},artist:{icon:n,layout:"grid",show_list_images:!0},channel:{icon:C,thumbnail_ratio:"portrait",layout:"grid",show_list_images:!0},composer:{icon:"M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4M11,6A2,2 0 0,0 9,8A2,2 0 0,0 11,10A2,2 0 0,0 13,8A2,2 0 0,0 11,6M11,13C12.1,13 13.66,13.23 15.11,13.69C14.5,14.07 14,14.6 13.61,15.23C12.79,15.03 11.89,14.9 11,14.9C8.03,14.9 4.9,16.36 4.9,17V18.1H13.04C13.13,18.8 13.38,19.44 13.76,20H3V17C3,14.34 8.33,13 11,13M18.5,10H20L22,10V12H20V17.5A2.5,2.5 0 0,1 17.5,20A2.5,2.5 0 0,1 15,17.5A2.5,2.5 0 0,1 17.5,15C17.86,15 18.19,15.07 18.5,15.21V10Z",layout:"grid",show_list_images:!0},contributing_artist:{icon:n,layout:"grid",show_list_images:!0},directory:{icon:"M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",layout:"grid",show_list_images:!0},episode:{icon:C,layout:"grid",thumbnail_ratio:"portrait",show_list_images:!0},game:{icon:"M7,6H17A6,6 0 0,1 23,12A6,6 0 0,1 17,18C15.22,18 13.63,17.23 12.53,16H11.47C10.37,17.23 8.78,18 7,18A6,6 0 0,1 1,12A6,6 0 0,1 7,6M6,9V11H4V13H6V15H8V13H10V11H8V9H6M15.5,12A1.5,1.5 0 0,0 14,13.5A1.5,1.5 0 0,0 15.5,15A1.5,1.5 0 0,0 17,13.5A1.5,1.5 0 0,0 15.5,12M18.5,9A1.5,1.5 0 0,0 17,10.5A1.5,1.5 0 0,0 18.5,12A1.5,1.5 0 0,0 20,10.5A1.5,1.5 0 0,0 18.5,9Z",layout:"grid",thumbnail_ratio:"portrait"},genre:{icon:"M8.11,19.45C5.94,18.65 4.22,16.78 3.71,14.35L2.05,6.54C1.81,5.46 2.5,4.4 3.58,4.17L13.35,2.1L13.38,2.09C14.45,1.88 15.5,2.57 15.72,3.63L16.07,5.3L20.42,6.23H20.45C21.5,6.47 22.18,7.53 21.96,8.59L20.3,16.41C19.5,20.18 15.78,22.6 12,21.79C10.42,21.46 9.08,20.61 8.11,19.45V19.45M20,8.18L10.23,6.1L8.57,13.92V13.95C8,16.63 9.73,19.27 12.42,19.84C15.11,20.41 17.77,18.69 18.34,16L20,8.18M16,16.5C15.37,17.57 14.11,18.16 12.83,17.89C11.56,17.62 10.65,16.57 10.5,15.34L16,16.5M8.47,5.17L4,6.13L5.66,13.94L5.67,13.97C5.82,14.68 6.12,15.32 6.53,15.87C6.43,15.1 6.45,14.3 6.62,13.5L7.05,11.5C6.6,11.42 6.21,11.17 6,10.81C6.06,10.2 6.56,9.66 7.25,9.5C7.33,9.5 7.4,9.5 7.5,9.5L8.28,5.69C8.32,5.5 8.38,5.33 8.47,5.17M15.03,12.23C15.35,11.7 16.03,11.42 16.72,11.57C17.41,11.71 17.91,12.24 18,12.86C17.67,13.38 17,13.66 16.3,13.5C15.61,13.37 15.11,12.84 15.03,12.23M10.15,11.19C10.47,10.66 11.14,10.38 11.83,10.53C12.5,10.67 13.03,11.21 13.11,11.82C12.78,12.34 12.11,12.63 11.42,12.5C10.73,12.33 10.23,11.8 10.15,11.19M11.97,4.43L13.93,4.85L13.77,4.05L11.97,4.43Z",layout:"grid",show_list_images:!0},image:{icon:"M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",layout:"grid",show_list_images:!0},movie:{icon:"M18,4L20,8H17L15,4H13L15,8H12L10,4H8L10,8H7L5,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V4H18Z",thumbnail_ratio:"portrait",layout:"grid",show_list_images:!0},music:{icon:"M21,3V15.5A3.5,3.5 0 0,1 17.5,19A3.5,3.5 0 0,1 14,15.5A3.5,3.5 0 0,1 17.5,12C18.04,12 18.55,12.12 19,12.34V6.47L9,8.6V17.5A3.5,3.5 0 0,1 5.5,21A3.5,3.5 0 0,1 2,17.5A3.5,3.5 0 0,1 5.5,14C6.04,14 6.55,14.12 7,14.34V6L21,3Z",show_list_images:!0},playlist:{icon:"M15,6H3V8H15V6M15,10H3V12H15V10M3,16H11V14H3V16M17,6V14.18C16.69,14.07 16.35,14 16,14A3,3 0 0,0 13,17A3,3 0 0,0 16,20A3,3 0 0,0 19,17V8H22V6H17Z",layout:"grid",show_list_images:!0},podcast:{icon:"M17,18.25V21.5H7V18.25C7,16.87 9.24,15.75 12,15.75C14.76,15.75 17,16.87 17,18.25M12,5.5A6.5,6.5 0 0,1 18.5,12C18.5,13.25 18.15,14.42 17.54,15.41L16,14.04C16.32,13.43 16.5,12.73 16.5,12C16.5,9.5 14.5,7.5 12,7.5C9.5,7.5 7.5,9.5 7.5,12C7.5,12.73 7.68,13.43 8,14.04L6.46,15.41C5.85,14.42 5.5,13.25 5.5,12A6.5,6.5 0 0,1 12,5.5M12,1.5A10.5,10.5 0 0,1 22.5,12C22.5,14.28 21.77,16.39 20.54,18.11L19.04,16.76C19.96,15.4 20.5,13.76 20.5,12A8.5,8.5 0 0,0 12,3.5A8.5,8.5 0 0,0 3.5,12C3.5,13.76 4.04,15.4 4.96,16.76L3.46,18.11C2.23,16.39 1.5,14.28 1.5,12A10.5,10.5 0 0,1 12,1.5M12,9.5A2.5,2.5 0 0,1 14.5,12A2.5,2.5 0 0,1 12,14.5A2.5,2.5 0 0,1 9.5,12A2.5,2.5 0 0,1 12,9.5Z",layout:"grid"},season:{icon:C,layout:"grid",thumbnail_ratio:"portrait",show_list_images:!0},track:{icon:"M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13,13H11V18A2,2 0 0,1 9,20A2,2 0 0,1 7,18A2,2 0 0,1 9,16C9.4,16 9.7,16.1 10,16.3V11H13V13M13,9V3.5L18.5,9H13Z"},tv_show:{icon:C,layout:"grid",thumbnail_ratio:"portrait"},url:{icon:"M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"},video:{icon:"M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z",layout:"grid",show_list_images:!0}},A=(t,e,i,a)=>t.callWS({type:"media_player/browse_media",entity_id:e,media_content_id:i,media_content_type:a}),H=t=>{let e=t.attributes.media_position;return"playing"!==t.state?e:(e+=(Date.now()-new Date(t.attributes.media_position_updated_at).getTime())/1e3,e<0?0:e)},p=t=>{let e;switch(t.attributes.media_content_type){case"music":case"image":e=t.attributes.media_artist;break;case"playlist":e=t.attributes.media_playlist||t.attributes.media_artist;break;case"tvshow":e=t.attributes.media_series_title,t.attributes.media_season&&(e+=" S"+t.attributes.media_season,t.attributes.media_episode&&(e+="E"+t.attributes.media_episode));break;case"channel":e=t.attributes.media_channel;break;default:e=t.attributes.app_name||""}return e},M=(t,e=!1)=>{if(!t)return;const i=t.state;if(i===r.Hh)return;const o=!0===t.attributes.assumed_state;if(!(0,a.a)(t)&&!o)return(0,s.$)(t,128)?[{icon:d,action:"turn_on"}]:void 0;const n=[];o&&(0,s.$)(t,128)&&n.push({icon:"M11,3H13V21H11V3Z",action:"turn_on"}),(0,s.$)(t,256)&&n.push({icon:o?"M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M12,19A7,7 0 0,1 5,12A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19Z":d,action:"turn_off"});const C=t.attributes;return("playing"===i||"paused"===i||o)&&(0,s.$)(t,32768)&&e&&n.push({icon:!0===C.shuffle?"M14.83,13.41L13.42,14.82L16.55,17.95L14.5,20H20V14.5L17.96,16.54L14.83,13.41M14.5,4L16.54,6.04L4,18.59L5.41,20L17.96,7.46L20,9.5V4M10.59,9.17L5.41,4L4,5.41L9.17,10.58L10.59,9.17Z":"M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16",action:"shuffle_set"}),("playing"===i||"paused"===i||o)&&(0,s.$)(t,16)&&n.push({icon:"M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z",action:"media_previous_track"}),!o&&("playing"===i&&((0,s.$)(t,1)||(0,s.$)(t,4096))||("paused"===i||"idle"===i)&&(0,s.$)(t,16384)||"on"===i&&((0,s.$)(t,16384)||(0,s.$)(t,1)))&&n.push({icon:"on"===i?"M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5":"playing"!==i?_:(0,s.$)(t,1)?l:u,action:"playing"!==i?"media_play":(0,s.$)(t,1)?"media_pause":"media_stop"}),o&&(0,s.$)(t,16384)&&n.push({icon:_,action:"media_play"}),o&&(0,s.$)(t,1)&&n.push({icon:l,action:"media_pause"}),o&&(0,s.$)(t,4096)&&n.push({icon:u,action:"media_stop"}),("playing"===i||"paused"===i||o)&&(0,s.$)(t,32)&&n.push({icon:"M16,18H18V6H16M6,18L14.5,12L6,6V18Z",action:"media_next_track"}),("playing"===i||"paused"===i||o)&&(0,s.$)(t,262144)&&e&&n.push({icon:"all"===C.repeat?"M17,17H7V14L3,18L7,22V19H19V13H17M7,7H17V10L21,6L17,2V5H5V11H7V7Z":"one"===C.repeat?"M13,15V9H12L10,10V11H11.5V15M17,17H7V14L3,18L7,22V19H19V13H17M7,7H17V10L21,6L17,2V5H5V11H7V7Z":"M2,5.27L3.28,4L20,20.72L18.73,22L15.73,19H7V22L3,18L7,14V17H13.73L7,10.27V11H5V8.27L2,5.27M17,13H19V17.18L17,15.18V13M17,5V2L21,6L17,10V7H8.82L6.82,5H17Z",action:"repeat_set"}),n.length>0?n:void 0},h=t=>{if(void 0===t||t===1/0)return"";const e=Math.max(0,Math.floor(t)),i=Math.floor(e/3600),a=Math.floor(e%3600/60),s=e%60,r=t=>t.toString().padStart(2,"0");return i>0?`${r(i)}:${r(a)}:${r(s)}`:`${r(a)}:${r(s)}`},m=t=>{if(!t)return;const e=t.indexOf("?authSig=");let i=e>0?t.slice(0,e):t;return i.startsWith("http")&&(i=decodeURIComponent(i.split("/").pop())),i},g=(t,e,i)=>t.callService("media_player","volume_set",{entity_id:e,volume_level:i}),y=(t,e,i)=>t.callService("media_player",i,"shuffle_set"===i?{entity_id:e.entity_id,shuffle:!e.attributes.shuffle}:"repeat_set"===i?{entity_id:e.entity_id,repeat:"all"===e.attributes.repeat?"one":"off"===e.attributes.repeat?"all":"off"}:{entity_id:e.entity_id}),b=(t,e,i,a,s={})=>(!s.enqueue&&void 0===s.announce&&(0,o.ni)(i)&&(s.announce=!0),t.callService("media_player","play_media",{entity_id:e,media_content_id:i,media_content_type:a,...s})),E=(t,e,i)=>t.callService("media_player","join",{group_members:i},{entity_id:e}),v=(t,e)=>t.callService("media_player","unjoin",{},{entity_id:e})},52069(t,e,i){i.d(e,{EF:()=>o,S_:()=>a,Xv:()=>n,ni:()=>r,u1:()=>l,z3:()=>_});const a=(t,e)=>t.callApi("POST","tts_get_url",e),s="media-source://tts/",r=t=>t.startsWith(s),o=t=>t.substring(19),n=(t,e,i)=>t.callWS({type:"tts/engine/list",language:e,country:i}),l=(t,e)=>t.callWS({type:"tts/engine/get",engine_id:e}),_=(t,e,i)=>t.callWS({type:"tts/engine/voices",engine_id:e,language:i})}};