iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
11 lines • 32.4 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["31664"],{60370:function(e,o,t){var i=t(61701),r=t(72621),s=(t(71695),t(19423),t(47021),t(10445)),a=t(57243),n=t(50778);let l,d,c,h,u=e=>e;(0,i.Z)([(0,n.Mo)("ha-assist-chip")],(function(e,o){class t extends o{constructor(...o){super(...o),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"filled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"active",value(){return!1}},{kind:"field",static:!0,key:"styles",value(){return[...(0,r.Z)(t,"styles",this),(0,a.iv)(l||(l=u`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-assist-chip-container-shape:var(
--ha-assist-chip-container-shape,
16px
);--md-assist-chip-outline-color:var(--outline-color);--md-assist-chip-label-text-weight:400}.filled{display:flex;pointer-events:none;border-radius:inherit;inset:0;position:absolute;background-color:var(--ha-assist-chip-filled-container-color)}::slotted([slot=icon]),::slotted([slot=trailing-icon]){display:flex;--mdc-icon-size:var(--md-input-chip-icon-size, 18px);font-size:var(--_label-text-size)!important}.trailing.icon ::slotted(*),.trailing.icon svg{margin-inline-end:unset;margin-inline-start:var(--_icon-label-space)}::before{background:var(--ha-assist-chip-container-color,transparent);opacity:var(--ha-assist-chip-container-opacity, 1)}:where(.active)::before{background:var(--ha-assist-chip-active-container-color);opacity:var(--ha-assist-chip-active-container-opacity)}.label{font-family:Roboto,sans-serif}`))]}},{kind:"method",key:"renderOutline",value:function(){return this.filled?(0,a.dy)(d||(d=u`<span class="filled"></span>`)):(0,r.Z)(t,"renderOutline",this,3)([])}},{kind:"method",key:"getContainerClasses",value:function(){return Object.assign(Object.assign({},(0,r.Z)(t,"getContainerClasses",this,3)([])),{},{active:this.active})}},{kind:"method",key:"renderPrimaryContent",value:function(){return(0,a.dy)(c||(c=u` <span class="leading icon" aria-hidden="true"> ${0} </span> <span class="label">${0}</span> <span class="touch"></span> <span class="trailing leading icon" aria-hidden="true"> ${0} </span> `),this.renderLeadingIcon(),this.label,this.renderTrailingIcon())}},{kind:"method",key:"renderTrailingIcon",value:function(){return(0,a.dy)(h||(h=u`<slot name="trailing-icon"></slot>`))}}]}}),s.X)},69546:function(e,o,t){var i=t(61701),r=t(72621),s=(t(19083),t(71695),t(92745),t(9359),t(31526),t(23669),t(19134),t(61006),t(47021),t(57243)),a=t(50778),n=t(35359);let l,d,c=e=>e;(0,i.Z)([(0,a.Mo)("ha-ansi-to-html")],(function(e,o){class t extends o{constructor(...o){super(...o),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,a.Cb)()],key:"content",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Boolean,attribute:"wrap-disabled"})],key:"wrapDisabled",value(){return!1}},{kind:"field",decorators:[(0,a.IO)("pre")],key:"_pre",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_filter",value(){return""}},{kind:"method",key:"render",value:function(){return(0,s.dy)(l||(l=c`<pre class="${0}"></pre>`),(0,n.$)({wrap:!this.wrapDisabled}))}},{kind:"method",key:"firstUpdated",value:function(e){(0,r.Z)(t,"firstUpdated",this,3)([e]),this.content&&this.parseTextToColoredPre(this.content)}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(d||(d=c`pre{overflow-x:auto;margin:0}pre.wrap{white-space:pre-wrap;overflow-wrap:break-word}.bold{font-weight:700}.italic{font-style:italic}.underline{text-decoration:underline}.strikethrough{text-decoration:line-through}.underline.strikethrough{text-decoration:underline line-through}.fg-red{color:var(--error-color)}.fg-green{color:var(--success-color)}.fg-yellow{color:var(--warning-color)}.fg-blue{color:var(--info-color)}.fg-magenta{color:#762671}.fg-cyan{color:#2cb5e9}.fg-white{color:#ccc}.bg-black{background-color:#000}.bg-red{background-color:var(--error-color)}.bg-green{background-color:var(--success-color)}.bg-yellow{background-color:var(--warning-color)}.bg-blue{background-color:var(--info-color)}.bg-magenta{background-color:#762671}.bg-cyan{background-color:#2cb5e9}.bg-white{background-color:#ccc}::highlight(search-results){background-color:var(--primary-color);color:var(--text-primary-color)}`))}},{kind:"method",key:"parseLinesToColoredPre",value:function(e,o=!1){for(const t of e)this.parseLineToColoredPre(t,o)}},{kind:"method",key:"parseLineToColoredPre",value:function(e,o=!1){const t=document.createElement("div"),i=/\x1b(?:\[(.*?)[@-~]|\].*?(?:\x07|\x1b\\))/g;let r=0;const s={bold:!1,italic:!1,underline:!1,strikethrough:!1,foregroundColor:null,backgroundColor:null},a=e=>{const o=document.createElement("span");s.bold&&o.classList.add("bold"),s.italic&&o.classList.add("italic"),s.underline&&o.classList.add("underline"),s.strikethrough&&o.classList.add("strikethrough"),null!==s.foregroundColor&&o.classList.add(`fg-${s.foregroundColor}`),null!==s.backgroundColor&&o.classList.add(`bg-${s.backgroundColor}`),o.appendChild(document.createTextNode(e)),t.appendChild(o)};let n;for(;null!==(n=i.exec(e));){const o=n.index,t=e.substring(r,o);t&&a(t),r=o+n[0].length,void 0!==n[1]&&n[1].split(";").forEach((e=>{switch(parseInt(e,10)){case 0:s.bold=!1,s.italic=!1,s.underline=!1,s.strikethrough=!1,s.foregroundColor=null,s.backgroundColor=null;break;case 1:s.bold=!0;break;case 3:s.italic=!0;break;case 4:s.underline=!0;break;case 9:s.strikethrough=!0;break;case 22:s.bold=!1;break;case 23:s.italic=!1;break;case 24:s.underline=!1;break;case 29:s.strikethrough=!1;break;case 30:case 39:s.foregroundColor=null;break;case 31:s.foregroundColor="red";break;case 32:s.foregroundColor="green";break;case 33:s.foregroundColor="yellow";break;case 34:s.foregroundColor="blue";break;case 35:s.foregroundColor="magenta";break;case 36:s.foregroundColor="cyan";break;case 37:s.foregroundColor="white";break;case 40:s.backgroundColor="black";break;case 41:s.backgroundColor="red";break;case 42:s.backgroundColor="green";break;case 43:s.backgroundColor="yellow";break;case 44:s.backgroundColor="blue";break;case 45:s.backgroundColor="magenta";break;case 46:s.backgroundColor="cyan";break;case 47:s.backgroundColor="white";break;case 49:s.backgroundColor=null}}))}const l=e.substring(r);var d,c;(l&&a(l),o)?(null===(d=this._pre)||void 0===d||d.prepend(t),t.animate([{opacity:0},{opacity:1}],{duration:500})):null===(c=this._pre)||void 0===c||c.appendChild(t);this._filter&&this.filterLines(this._filter)}},{kind:"method",key:"parseTextToColoredPre",value:function(e){const o=e.split("\n");for(const t of o)this.parseLineToColoredPre(t)}},{kind:"method",key:"filterLines",value:function(e){var o;this._filter=e;const t=(null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll("div"))||[];let i=0;if(e){const o=[];t.forEach((t=>{var r;if(null!==(r=t.textContent)&&void 0!==r&&r.toLowerCase().includes(e.toLowerCase())){if(t.style.display="",i++,CSS.highlights&&null!==t.firstChild&&t.textContent){t.querySelectorAll("span").forEach((t=>{const i=t.textContent.toLowerCase(),r=[];let s=0;for(;s<i.length;){const o=i.indexOf(e.toLowerCase(),s);if(-1===o)break;r.push(o),s=o+e.length}r.forEach((i=>{const r=new Range;r.setStart(t.firstChild,i),r.setEnd(t.firstChild,i+e.length),o.push(r)}))}))}}else t.style.display="none"})),CSS.highlights&&CSS.highlights.set("search-results",new Highlight(...o))}else t.forEach((e=>{e.style.display=""})),i=t.length,CSS.highlights&&CSS.highlights.delete("search-results");return!!i}},{kind:"method",key:"clear",value:function(){this._pre&&(this._pre.innerHTML="")}}]}}),s.oi)},51868:function(e,o,t){var i=t(61701),r=t(72621),s=(t(71695),t(47021),t(1231)),a=t(57243),n=t(50778);let l,d=e=>e;(0,i.Z)([(0,n.Mo)("ha-md-divider")],(function(e,o){class t extends o{constructor(...o){super(...o),e(this)}}return{F:t,d:[{kind:"field",static:!0,key:"styles",value(){return[...(0,r.Z)(t,"styles",this),(0,a.iv)(l||(l=d`:host{--md-divider-color:var(--divider-color)}`))]}}]}}),s.B)},7843:function(e,o,t){var i=t(61701),r=t(72621),s=(t(71695),t(47021),t(28674)),a=t(57243),n=t(50778);let l,d=e=>e;(0,i.Z)([(0,n.Mo)("ha-md-menu-item")],(function(e,o){class t extends o{constructor(...o){super(...o),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"clickAction",value:void 0},{kind:"field",static:!0,key:"styles",value(){return[...(0,r.Z)(t,"styles",this),(0,a.iv)(l||(l=d`:host{--ha-icon-display:block;--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-primary:var(--primary-text-color);--md-sys-color-secondary:var(--secondary-text-color);--md-sys-color-surface:var(--card-background-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--secondary-text-color);--md-sys-color-secondary-container:rgba(
var(--rgb-primary-color),
0.15
);--md-sys-color-on-secondary-container:var(--text-primary-color);--mdc-icon-size:16px;--md-sys-color-on-primary-container:var(--primary-text-color);--md-sys-color-on-secondary-container:var(--primary-text-color);--md-menu-item-label-text-font:Roboto,sans-serif}:host(.warning){--md-menu-item-label-text-color:var(--error-color);--md-menu-item-leading-icon-color:var(--error-color)}::slotted([slot=headline]){text-wrap:nowrap}`))]}}]}}),s.i)},96090:function(e,o,t){var i=t(61701),r=t(72621),s=(t(71695),t(47021),t(53336)),a=t(7162),n=t(57243),l=t(50778);let d,c=e=>e;(0,i.Z)([(0,l.Mo)("ha-menu")],(function(e,o){class t extends o{constructor(...o){super(...o),e(this)}}return{F:t,d:[{kind:"method",key:"connectedCallback",value:function(){(0,r.Z)(t,"connectedCallback",this,3)([]),this.addEventListener("close-menu",this._handleCloseMenu)}},{kind:"method",key:"_handleCloseMenu",value:function(e){var o,t;e.detail.reason.kind===a.GB.KEYDOWN&&e.detail.reason.key===a.KC.ESCAPE||null===(o=(t=e.detail.initiator).clickAction)||void 0===o||o.call(t,e.detail.initiator)}},{kind:"field",static:!0,key:"styles",value(){return[...(0,r.Z)(t,"styles",this),(0,n.iv)(d||(d=c`:host{--md-sys-color-surface-container:var(--card-background-color)}`))]}}]}}),s.xX)},17170:function(e,o,t){t.a(e,(async function(e,i){try{t.r(o),t.d(o,{HaSpinner:()=>p});var r=t(61701),s=t(72621),a=(t(71695),t(47021),t(97677)),n=t(43580),l=t(57243),d=t(50778),c=e([a]);a=(c.then?(await c)():c)[0];let h,u=e=>e,p=(0,r.Z)([(0,d.Mo)("ha-spinner")],(function(e,o){class t extends o{constructor(...o){super(...o),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,d.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(e){if((0,s.Z)(t,"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(){return[n.Z,(0,l.iv)(h||(h=u`: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)}`))]}}]}}),a.Z);i()}catch(h){i(h)}}))},75951:function(e,o,t){t.d(o,{G:()=>i,l:()=>r});const i=e=>e.callApi("GET","error_log"),r="/api/error_log"},56785:function(e,o,t){t.d(o,{js:()=>s,rY:()=>r,yd:()=>l,yz:()=>n});t(19083),t(71695),t(40251),t(92519),t(42179),t(89256),t(24931),t(88463),t(57449),t(19814),t(61006),t(47021);var i=t(17803);const r=e=>e.data,s=e=>"object"==typeof e?"object"==typeof e.body?e.body.message||"Unknown error, see supervisor logs":e.body||e.message||"Unknown error, see supervisor logs":e,a=new Set([502,503,504]),n=e=>!!(e&&e.status_code&&a.has(e.status_code))||!(!e||!e.message||!e.message.includes("ERR_CONNECTION_CLOSED")&&!e.message.includes("ERR_CONNECTION_RESET")),l=async(e,o)=>(0,i.I)(e.config.version,2021,2,4)?e.callWS({type:"supervisor/api",endpoint:`/${o}/stats`,method:"get"}):r(await e.callApi("GET",`hassio/${o}/stats`))},79960:function(e,o,t){t.d(o,{Bq:()=>g,CP:()=>a,KQ:()=>l,Lm:()=>n,NC:()=>c,Ri:()=>h,gM:()=>p,jP:()=>v,lC:()=>s,rM:()=>u,wt:()=>d});t(19083),t(40251),t(61006);var i=t(17803),r=t(56785);const s=async e=>{(0,i.I)(e.config.version,2021,2,4)?await e.callWS({type:"supervisor/api",endpoint:"/supervisor/reload",method:"post"}):await e.callApi("POST","hassio/supervisor/reload")},a=async e=>(0,i.I)(e.config.version,2021,2,4)?e.callWS({type:"supervisor/api",endpoint:"/supervisor/info",method:"get"}):(0,r.rY)(await e.callApi("GET","hassio/supervisor/info")),n=async e=>(0,i.I)(e.config.version,2021,2,4)?e.callWS({type:"supervisor/api",endpoint:"/info",method:"get"}):(0,r.rY)(await e.callApi("GET","hassio/info")),l=async e=>e.callApi("GET","hassio/host/logs/boots"),d=async(e,o)=>e.callApi("GET",`hassio/${o.includes("_")?`addons/${o}`:o}/logs`),c=async(e,o,t,i=0)=>e.callApiRaw("GET",`hassio/${o.includes("_")?`addons/${o}`:o}/logs${0!==i?`/boots/${i}`:""}`,void 0,t?{Range:t}:void 0),h=async(e,o,t,i=100,r=0)=>e.callApiRaw("GET",`hassio/${o.includes("_")?`addons/${o}`:o}/logs${0!==r?`/boots/${r}`:""}/follow?lines=${i}`,void 0,void 0,t),u=async(e,o,t,i,r,s=100,a=0)=>e.callApiRaw("GET",`hassio/${o.includes("_")?`addons/${o}`:o}/logs${0!==a?`/boots/${a}`:""}/follow`,void 0,{Range:`entries=${i}:${r}:${s}`},t),p=e=>`/api/hassio/${e.includes("_")?`addons/${e}`:e}/logs`,g=(e,o,t=0)=>`/api/hassio/${e.includes("_")?`addons/${e}`:e}/logs${0!==t?`/boots/${t}`:""}?lines=${o}`,v=async(e,o)=>{(0,i.I)(e.config.version,2021,2,4)?await e.callWS({type:"supervisor/api",endpoint:"/supervisor/options",method:"post",data:o}):await e.callApi("POST","hassio/supervisor/options",o)}},74713:function(e,o,t){t.a(e,(async function(e,o){try{var i=t(61701),r=t(72621),s=(t(52247),t(71695),t(61495),t(61893),t(9359),t(56475),t(70104),t(40251),t(19134),t(97499),t(97003),t(81804),t(47021),t(87319),t(57243)),a=t(35359),n=t(19301),l=t(50778),d=(t(99426),t(69546),t(54977),t(59826),t(23334),t(37583),t(17170)),c=(t(60370),t(96090),t(7843),t(51868),t(34273),t(7285),t(43546)),h=t(75951),u=t(56785),p=t(79960),g=t(58014),v=t(36522),f=(t(17803),t(72344)),m=t(22381),k=t(64145),b=e([d]);d=(b.then?(await b)():b)[0];let y,_,w,C,S,x,L,$,T,H,A,E,B,M,V,P,Z,O=e=>e;const I="M19.92,12.08L12,20L4.08,12.08L5.5,10.67L11,16.17V2H13V16.17L18.5,10.66L19.92,12.08M12,20H2V22H22V20H12Z",z="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",F="M12,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",R="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",G="M7,13V11H21V13H7M7,19V17H21V19H7M7,7V5H21V7H7M3,8V5H2V4H4V8H3M2,17V16H5V20H2V19H4V18.5H3V17.5H4V17H2M4.25,10A0.75,0.75 0 0,1 5,10.75C5,10.95 4.92,11.14 4.79,11.27L3.12,13H5V14H2V13.08L4,11H2V10H4.25Z",N="M7,10L12,15L17,10H7Z",j="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",U="M21,5H3V7H21V5M3,19H10V17H3V19M3,13H18C19,13 20,13.43 20,15C20,16.57 19,17 18,17H16V15L12,18L16,21V19H18C20.95,19 22,17.73 22,15C22,12.28 21,11 18,11H3V13Z",W="M16,7H3V5H16V7M3,19H16V17H3V19M22,12L18,9V11H3V13H18V15L22,12Z",X="M20,18H4V8H20M20,6H12L10,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8A2,2 0 0,0 20,6M15,16H6V14H15V16M18,12H6V10H18V12Z",D=100;(0,i.Z)([(0,l.Mo)("error-log-card")],(function(e,o){class t extends o{constructor(...o){super(...o),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"localizeFunc",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"filter",value(){return""}},{kind:"field",decorators:[(0,l.Cb)()],key:"header",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"provider",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:"allow-switch",type:Boolean})],key:"allowSwitch",value(){return!1}},{kind:"field",decorators:[(0,l.IO)(".error-log")],key:"_logElement",value:void 0},{kind:"field",decorators:[(0,l.IO)("#scroll-top-marker")],key:"_scrollTopMarkerElement",value:void 0},{kind:"field",decorators:[(0,l.IO)("#scroll-bottom-marker")],key:"_scrollBottomMarkerElement",value:void 0},{kind:"field",decorators:[(0,l.IO)("ha-ansi-to-html")],key:"_ansiToHtmlElement",value:void 0},{kind:"field",decorators:[(0,l.IO)("#boots-menu")],key:"_bootsMenu",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_firstCursor",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_scrolledToBottomController",value(){return new n.r(this,{callback(e){return e[0].isIntersecting}})}},{kind:"field",decorators:[(0,l.SB)()],key:"_scrolledToTopController",value(){return new n.r(this,{})}},{kind:"field",decorators:[(0,l.SB)()],key:"_newLogsIndicator",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_logStreamAborter",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_streamSupported",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_loadingState",value(){return"loading"}},{kind:"field",decorators:[(0,l.SB)()],key:"_loadingPrevState",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_noSearchResults",value(){return!1}},{kind:"field",decorators:[(0,l.SB)()],key:"_numberOfLines",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_boot",value(){return 0}},{kind:"field",decorators:[(0,l.SB)()],key:"_boots",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_showBootsSelect",value(){return!1}},{kind:"field",decorators:[(0,l.SB)()],key:"_wrapLines",value(){return!0}},{kind:"field",decorators:[(0,l.SB)()],key:"_downloadSupported",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_logsFileLink",value:void 0},{kind:"method",key:"render",value:function(){const e=this._streamSupported&&this.provider&&(0,f.p)(this.hass,"hassio")&&"loading"!==this._loadingState,o=this._streamSupported&&Array.isArray(this._boots),t=this.localizeFunc||this.hass.localize;return(0,s.dy)(y||(y=O` <div class="error-log-intro"> ${0} <ha-card outlined> <div class="header"> <h1 class="card-header"> ${0} </h1> <div class="action-buttons"> ${0} ${0} <ha-icon-button .path="${0}" ="${0}" .label="${0}"></ha-icon-button> ${0} ${0} </div> </div> <div class="card-content error-log"> <div id="scroll-top-marker"></div> ${0} ${0} ${0} <ha-ansi-to-html ?wrap-disabled="${0}"></ha-ansi-to-html> <div id="scroll-bottom-marker"></div> </div> <ha-button class="new-logs-indicator ${0}" ="${0}"> <ha-svg-icon .path="${0}" slot="icon"></ha-svg-icon> ${0} <ha-svg-icon .path="${0}" slot="trailingIcon"></ha-svg-icon> </ha-button> ${0} </ha-card> </div> `),this._error?(0,s.dy)(_||(_=O`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):s.Ld,this.header||t("ui.panel.config.logs.show_full_logs"),o&&this._showBootsSelect?(0,s.dy)(w||(w=O` <ha-assist-chip .title="${0}" .label="${0}" id="boots-anchor" ="${0}"> <ha-svg-icon slot="trailing-icon" .path="${0}"></ha-svg-icon></ha-assist-chip> <ha-menu anchor="boots-anchor" id="boots-menu" positioning="fixed"> ${0} </ha-menu> `),t("ui.panel.config.logs.haos_boots_title"),0===this._boot?t("ui.panel.config.logs.current"):-1===this._boot?t("ui.panel.config.logs.previous"):t("ui.panel.config.logs.startups_ago",{boot:-1*this._boot}),this._toggleBootsMenu,N,this._boots.map((e=>(0,s.dy)(C||(C=O` <ha-md-menu-item .value="${0}" ="${0}" .selected="${0}"> ${0} </ha-md-menu-item> ${0} `),e,this._setBoot,e===this._boot,0===e?t("ui.panel.config.logs.current"):-1===e?t("ui.panel.config.logs.previous"):t("ui.panel.config.logs.startups_ago",{boot:-1*e}),0===e?(0,s.dy)(S||(S=O`<ha-md-divider role="separator"></ha-md-divider>`)):s.Ld)))):s.Ld,this._downloadSupported?(0,s.dy)(x||(x=O` <ha-icon-button .path="${0}" ="${0}" .label="${0}"></ha-icon-button> `),R,this._downloadLogs,t("ui.panel.config.logs.download_logs")):this._logsFileLink?(0,s.dy)(L||(L=O` <a href="${0}" target="_blank" class="download-link"> <ha-icon-button .path="${0}" .label="${0}"></ha-icon-button> </a> `),this._logsFileLink,R,t("ui.panel.config.logs.download_logs")):s.Ld,this._wrapLines?W:U,this._toggleLineWrap,t("ui.panel.config.logs."+(this._wrapLines?"full_width":"wrap_lines")),!e||this._error?(0,s.dy)($||($=O`<ha-icon-button .path="${0}" ="${0}" .label="${0}"></ha-icon-button>`),j,this._loadLogs,t("ui.common.refresh")):s.Ld,this.allowSwitch&&"core"===this.provider||o?(0,s.dy)(T||(T=O` <ha-button-menu ="${0}"> <ha-icon-button slot="trigger" .path="${0}"> </ha-icon-button> ${0} ${0} </ha-button-menu> `),this._handleOverflowAction,z,this.allowSwitch&&"core"===this.provider?(0,s.dy)(H||(H=O`<ha-list-item graphic="icon"> <ha-svg-icon slot="graphic" .path="${0}"></ha-svg-icon> ${0} </ha-list-item>`),X,this.hass.localize("ui.panel.config.logs.show_condensed_logs")):s.Ld,o?(0,s.dy)(A||(A=O`<ha-list-item graphic="icon"> <ha-svg-icon slot="graphic" .path="${0}"></ha-svg-icon> ${0} </ha-list-item>`),G,t(`ui.panel.config.logs.${this._showBootsSelect?"hide":"show"}_haos_boots`)):s.Ld):s.Ld,"loading"===this._loadingPrevState?(0,s.dy)(E||(E=O`<div class="loading-old"> <ha-spinner></ha-spinner> </div>`)):s.Ld,"loading"===this._loadingState?(0,s.dy)(B||(B=O`<div>${0}</div>`),t("ui.panel.config.logs.loading_log")):"empty"===this._loadingState?(0,s.dy)(M||(M=O`<div>${0}</div>`),t("ui.panel.config.logs.no_errors")):s.Ld,"loaded"===this._loadingState&&this.filter&&this._noSearchResults?(0,s.dy)(V||(V=O`<div> ${0} </div>`),t("ui.panel.config.logs.no_issues_search",{term:this.filter})):s.Ld,!this._wrapLines,(0,a.$)({visible:this._newLogsIndicator&&!this._scrolledToBottomController.value||!1}),this._scrollToBottom,I,t("ui.panel.config.logs.scroll_down_button"),I,e&&0===this._boot&&!this._error?(0,s.dy)(P||(P=O`<div class="live-indicator"> <ha-svg-icon path="${0}"></ha-svg-icon> Live </div>`),F):s.Ld)}},{kind:"method",key:"willUpdate",value:function(e){(0,r.Z)(t,"willUpdate",this,3)([e]),this.hasUpdated||(this._downloadSupported=(0,g.G)(this.hass),this._streamSupported=!0,this._loadBoots(),window.addEventListener("connection-status",this._handleConnectionStatus),this.hass.loadFragmentTranslation("config")),e.has("provider")&&(this._boot=0,this._loadLogs())}},{kind:"method",key:"firstUpdated",value:function(e){(0,r.Z)(t,"firstUpdated",this,3)([e]),this._scrolledToBottomController.observe(this._scrollBottomMarkerElement),this._scrolledToTopController.callback=this._handleTopScroll,this._scrolledToTopController.observe(this._scrollTopMarkerElement)}},{kind:"method",key:"updated",value:function(e){(0,r.Z)(t,"updated",this,3)([e]),this._newLogsIndicator&&this._scrolledToBottomController.value&&(this._newLogsIndicator=!1),e.has("filter")&&this._debounceSearch(),e.has("_loadingState")&&"loaded"===this._loadingState&&this._scrolledToTopController.value&&this._firstCursor&&!this._loadingPrevState&&this._loadMoreLogs()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,r.Z)(t,"disconnectedCallback",this,3)([]),this._logStreamAborter&&this._logStreamAborter.abort(),window.removeEventListener("connection-status",this._handleConnectionStatus)}},{kind:"method",key:"_downloadLogs",value:async function(){if(this._streamSupported&&this.provider)(0,k.X)(this,{header:this.header,provider:this.provider,defaultLineCount:this._numberOfLines,boot:this._boot});else{const e=(new Date).toISOString().replace(/:/g,"-"),o=this.provider&&"core"!==this.provider?(0,p.gM)(this.provider):h.l,t=this.provider&&"core"!==this.provider?`${this.provider}_${e}.log`:`home-assistant_${e}.log`,i=await(0,c.iI)(this.hass,o);(0,g.N)(i.path,t)}}},{kind:"method",key:"_loadLogs",value:async function(e=!1){var o,t;(this._error=void 0,this._loadingState="loading",this._numberOfLines=e&&null!==(o=this._numberOfLines)&&void 0!==o?o:0,e)||(this._loadingPrevState=void 0,this._firstCursor=void 0,null===(t=this._ansiToHtmlElement)||void 0===t||t.clear());const i=this._streamSupported&&(0,f.p)(this.hass,"hassio")&&this.provider;try{if(this._logStreamAborter&&(this._logStreamAborter.abort(),this._logStreamAborter=void 0),i){if(this._logStreamAborter=new AbortController,!e){const e=await(0,p.NC)(this.hass,this.provider,"entries=:-1:",this._boot);(await e.text()).trim()||(this._loadingState="empty")}let o;if(o=e&&this._firstCursor?await(0,p.rM)(this.hass,this.provider,this._logStreamAborter.signal,this._firstCursor,this._numberOfLines,D,this._boot):await(0,p.Ri)(this.hass,this.provider,this._logStreamAborter.signal,D,this._boot),o.headers.has("X-First-Cursor")&&(this._firstCursor=o.headers.get("X-First-Cursor")),!o.body)throw new Error("No stream body found");this._loadingState="empty";let t="";const i=o.body.getReader(),s=new TextDecoder;let a=!1;for(;!a;){const{value:o,done:n}=await i.read();if(a=n,o){const i=s.decode(o,{stream:!a}),n=this._scrolledToBottomController.value,l=`${t}${i}`.split("\n").filter((e=>""!==e.trim()));var r;if(t=i.endsWith("\n")?"":l.splice(-1,1)[0],l.length)null===(r=this._ansiToHtmlElement)||void 0===r||r.parseLinesToColoredPre(l),this._numberOfLines+=l.length,"empty"===this._loadingState&&setTimeout((()=>{this._loadingState="loaded"}),100);if(n&&this._logElement?this._scrollToBottom():this._newLogsIndicator=!0,!this._downloadSupported){const e=(0,p.Bq)(this.provider,this._numberOfLines,this._boot);(0,c.iI)(this.hass,e).then((e=>{this._logsFileLink=e.path}))}e=!1}}}else{this._streamSupported=!1;let e="";var s;if(e=(0,f.p)(this.hass,"hassio")&&this.provider?await(0,p.wt)(this.hass,this.provider):await(0,h.G)(this.hass),e)null===(s=this._ansiToHtmlElement)||void 0===s||s.parseTextToColoredPre(e),this._loadingState="loaded",this._scrollToBottom()}}catch(a){if("AbortError"===a.name)return;if(!e&&i)return void this._loadLogs(!0);this._error=(this.localizeFunc||this.hass.localize)("ui.panel.config.logs.failed_get_logs",{provider:this.provider,error:(0,u.js)(a)})}}},{kind:"field",key:"_debounceSearch",value(){return(0,m.D)((()=>{var e;this._noSearchResults=!(null!==(e=this._ansiToHtmlElement)&&void 0!==e&&e.filterLines(this.filter)),this.filter||this._scrollToBottom()}),150)}},{kind:"field",key:"_debounceScrollToBottom",value(){return(0,m.D)((()=>{this._logElement.scrollTop=this._logElement.scrollHeight}),300)}},{kind:"method",key:"_scrollToBottom",value:function(){this._logElement&&(this._newLogsIndicator=!1,"core"!==this.provider?this._logElement.scrollTo(0,this._logElement.scrollHeight):this._debounceScrollToBottom())}},{kind:"field",key:"_handleConnectionStatus",value(){return e=>{"disconnected"===e.detail&&this._logStreamAborter&&(this._logStreamAborter.abort(),this._loadingState="loading"),"connected"===e.detail&&this._loadLogs(!0)}}},{kind:"method",key:"_loadMoreLogs",value:async function(){if(!this._firstCursor||"loading"===this._loadingPrevState||"loaded"!==this._loadingState||!this._logElement||!this.provider)return;const e=this._scrolledToBottomController.value,o=this._logElement.scrollHeight-this._logElement.scrollTop;this._loadingPrevState="loading";const t=await(0,p.NC)(this.hass,this.provider,`entries=${this._firstCursor}:-100:100`,this._boot);if(t.headers.has("X-First-Cursor")){if(this._firstCursor===t.headers.get("X-First-Cursor"))return void(this._loadingPrevState="end");this._firstCursor=t.headers.get("X-First-Cursor")}const i=await t.text();if(i){var r;const e=i.split("\n").filter((e=>""!==e.trim())).reverse();null===(r=this._ansiToHtmlElement)||void 0===r||r.parseLinesToColoredPre(e,!0),this._numberOfLines+=e.length,this._loadingPrevState="loaded"}else this._loadingPrevState="end";e?this._scrollToBottom():"end"!==this._loadingPrevState&&this._logElement&&window.requestAnimationFrame((()=>{this._logElement.scrollTop=this._logElement.scrollHeight-o}))}},{kind:"field",key:"_handleTopScroll",value(){return e=>{const o=e[0].isIntersecting;return!this._firstCursor||!o||"loaded"!==this._loadingState||this._loadingPrevState&&"loaded"!==this._loadingPrevState||this.filter||this._loadMoreLogs(),o}}},{kind:"method",key:"_loadBoots",value:async function(){if(this._streamSupported&&(0,f.p)(this.hass,"hassio"))try{const{data:e}=await(0,p.KQ)(this.hass),o=Object.keys(e.boots).map(Number).sort(((e,o)=>o-e));o.length>1&&(this._boots=o)}catch(e){console.error(e)}}},{kind:"method",key:"_toggleLineWrap",value:function(){this._wrapLines=!this._wrapLines}},{kind:"method",key:"_handleOverflowAction",value:function(e){let o=e.detail.index;switch("core"===this.provider&&o--,o){case-1:(0,v.B)(this,"switch-log-view");break;case 0:this._showBootsSelect=!this._showBootsSelect}}},{kind:"method",key:"_toggleBootsMenu",value:function(){this._bootsMenu&&(this._bootsMenu.open=!this._bootsMenu.open)}},{kind:"method",key:"_setBoot",value:function(e){this._boot=e.target.value,this._loadLogs()}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(Z||(Z=O`:host{direction:var(--direction)}.error-log-intro{text-align:center;margin:16px}ha-card{padding-top:8px;position:relative}ha-card.hidden{display:none}ha-card .action-buttons{display:flex;align-items:center;height:100%}.header{display:flex;justify-content:space-between;padding:0 16px}.card-header{color:var(--ha-card-header-color,var(--primary-text-color));font-family:var(--ha-card-header-font-family, inherit);font-size:var(--ha-card-header-font-size, 24px);letter-spacing:-.012em;line-height:48px;display:block;margin-block-start:0px;font-weight:400;white-space:nowrap;max-width:calc(100% - 150px);overflow:hidden;text-overflow:ellipsis}ha-icon-button{float:right}.error-log{position:relative;font-family:var(--code-font-family, monospace);clear:both;text-align:start;padding-top:16px;padding-bottom:16px;overflow-y:scroll;min-height:var(--error-log-card-height,calc(100vh - 240px));max-height:var(--error-log-card-height,calc(100vh - 240px));border-top:1px solid var(--divider-color);direction:ltr} all and (max-width:870px){.error-log{min-height:var(--error-log-card-height,calc(100vh - 190px));max-height:var(--error-log-card-height,calc(100vh - 190px))}}.error-log>div{overflow:auto;overflow-wrap:break-word}.error-log>div:hover{background-color:var(--secondary-background-color)}.new-logs-indicator{--mdc-theme-primary:var(--text-primary-color);overflow:hidden;position:absolute;bottom:0;left:0;right:0;height:0;background-color:var(--primary-color);border-radius:8px;transition:height .4s ease-out;display:flex;justify-content:space-between;align-items:center}.new-logs-indicator.visible{height:24px}.error{color:var(--error-color)}.warning{color:var(--warning-color)}.loading-old{display:flex;width:100%;justify-content:center;padding:16px}ha-assist-chip{--ha-assist-chip-container-shape:10px;--md-assist-chip-trailing-space:8px} breathe{from{opacity:.8}to{opacity:0}}.live-indicator{position:absolute;bottom:0;inset-inline-end:16px;border-top-right-radius:8px;border-top-left-radius:8px;background-color:var(--primary-color);color:var(--text-primary-color);padding:4px 8px;opacity:.8}.live-indicator ha-svg-icon{animation:breathe 1s cubic-bezier(.5,0,1,1) infinite alternate;height:14px;width:14px}.download-link{color:var(--text-color)}`))}}]}}),s.oi);o()}catch(y){o(y)}}))},64145:function(e,o,t){t.d(o,{X:()=>r});t(71695),t(40251),t(47021);var i=t(36522);const r=(e,o)=>{(0,i.B)(e,"show-dialog",{dialogTag:"dialog-download-logs",dialogImport:()=>Promise.all([t.e("81465"),t.e("7442"),t.e("86628"),t.e("38267")]).then(t.bind(t,1518)),dialogParams:o})}},58014:function(e,o,t){t.d(o,{N:()=>r,G:()=>s});var i=t(18117);const r=(e,o="")=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.download=o,t.style.display="none",document.body.appendChild(t),t.dispatchEvent(new MouseEvent("click")),document.body.removeChild(t)},s=e=>{var o;return!(e=>!!e.auth.external&&i.G)(e)||!(null===(o=e.auth.external)||void 0===o||!o.config.downloadFileSupported)}},18117:function(e,o,t){t.d(o,{G:()=>i});t(19134),t(5740);const i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}]);
//# sourceMappingURL=31664.04ac9fe6e353f302.js.map