UNPKG

iobroker.lovelace

Version:

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

1 lines 24.4 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[86269],{57781:function(o,t,e){e(74423),e(44114),e(18111),e(7588),e(27495),e(62953);var r=e(40445),i=e(5124),s=e(67576),a=e(6412);let l,n,d=o=>o;class h extends i.WF{render(){return(0,i.qy)(l||(l=d`<pre class="${0}"></pre>`),(0,a.H)({wrap:!this.wrapDisabled}))}firstUpdated(o){super.firstUpdated(o),this.content&&this.parseTextToColoredPre(this.content)}parseLinesToColoredPre(o,t=!1){for(const e of o)this.parseLineToColoredPre(e,t)}parseLineToColoredPre(o,t=!1){const e=document.createElement("div"),r=/\x1b(?:\[(.*?)[@-~]|\].*?(?:\x07|\x1b\\))/g;let i=0;const s={bold:!1,italic:!1,underline:!1,strikethrough:!1,foregroundColor:null,backgroundColor:null},a=o=>{const t=document.createElement("span");s.bold&&t.classList.add("bold"),s.italic&&t.classList.add("italic"),s.underline&&t.classList.add("underline"),s.strikethrough&&t.classList.add("strikethrough"),null!==s.foregroundColor&&t.classList.add(`fg-${s.foregroundColor}`),null!==s.backgroundColor&&t.classList.add(`bg-${s.backgroundColor}`),t.appendChild(document.createTextNode(o)),e.appendChild(t)};let l;for(;null!==(l=r.exec(o));){const t=l.index,e=o.substring(i,t);e&&a(e),i=t+l[0].length,void 0!==l[1]&&l[1].split(";").forEach(o=>{switch(parseInt(o,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 n=o.substring(i);var d,h;(n&&a(n),t)?(null===(d=this._pre)||void 0===d||d.prepend(e),e.animate([{opacity:0},{opacity:1}],{duration:500})):null===(h=this._pre)||void 0===h||h.appendChild(e);this._filter&&this.filterLines(this._filter)}parseTextToColoredPre(o){const t=o.split("\n");for(const e of t)this.parseLineToColoredPre(e)}filterLines(o){this._filter=o;const t=this._divs;let e=0;if(o){const r=[];t.forEach(t=>{var i;if(null!==(i=t.textContent)&&void 0!==i&&i.toLowerCase().includes(o.toLowerCase())){if(t.style.display="",e++,CSS.highlights&&null!==t.firstChild&&t.textContent){t.querySelectorAll("span").forEach(t=>{const e=t.textContent.toLowerCase(),i=[];let s=0;for(;s<e.length;){const t=e.indexOf(o.toLowerCase(),s);if(-1===t)break;i.push(t),s=t+o.length}i.forEach(e=>{const i=new Range;i.setStart(t.firstChild,e),i.setEnd(t.firstChild,e+o.length),r.push(i)})})}}else t.style.display="none"}),CSS.highlights&&CSS.highlights.set("search-results",new Highlight(...r))}else t.forEach(o=>{o.style.display=""}),e=t.length,CSS.highlights&&CSS.highlights.delete("search-results");return!!e}clear(){this._pre&&(this._pre.innerHTML="")}constructor(...o){super(...o),this.wrapDisabled=!1,this._filter=""}}h.styles=(0,i.AH)(n||(n=d`pre{margin:0}pre.wrap{white-space:pre-wrap;overflow-wrap:break-word}.bold{font-weight:var(--ha-font-weight-bold)}.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)}`)),(0,r.Cg)([(0,s.MZ)()],h.prototype,"content",void 0),(0,r.Cg)([(0,s.MZ)({type:Boolean,attribute:"wrap-disabled"})],h.prototype,"wrapDisabled",void 0),(0,r.Cg)([(0,s.P)("pre")],h.prototype,"_pre",void 0),(0,r.Cg)([(0,s.YG)("div")],h.prototype,"_divs",void 0),(0,r.Cg)([(0,s.wk)()],h.prototype,"_filter",void 0),h=(0,r.Cg)([(0,s.EM)("ha-ansi-to-html")],h)},70555:function(o,t,e){e.d(t,{L:function(){return s},_:function(){return a}});var r=e(36312),i=e(62384);const s=o=>o.callApi("GET","error_log"),a=o=>(0,r.x)(o.config,"hassio")&&(0,i.v)(o.config.version,2025,10)?"/api/hassio/core/logs/latest":"/api/error_log"},16869:function(o,t,e){e.d(t,{B:function(){return s},g:function(){return i}});var r;e(74423),e(27495);const i=window.externalAppV2||window.externalApp||(null===(r=window.webkit)||void 0===r||null===(r=r.messageHandlers)||void 0===r?void 0:r.getExternalAuth)||location.search.includes("external_auth=1"),s=window.externalApp||window.externalAppV2},47351:function(o,t,e){e.d(t,{PS:function(){return r},Tv:function(){return a},VR:function(){return i},lE:function(){return l}});e(74423),e(3362),e(17642),e(58004),e(33853),e(45876),e(32475),e(15024),e(31698),e(62953);const r=o=>o.data,i=o=>"object"==typeof o?"object"==typeof o.body?o.body.message||"Unknown error, see supervisor logs":o.body||o.message||"Unknown error, see supervisor logs":o,s=new Set([502,503,504]),a=o=>!!(o&&o.status_code&&s.has(o.status_code))||!(!o||!o.message||!o.message.includes("ERR_CONNECTION_CLOSED")&&!o.message.includes("ERR_CONNECTION_RESET")),l=async(o,t)=>o({type:"supervisor/api",endpoint:`/${t}/stats`,method:"get"})},90600:function(o,t,e){e.d(t,{GM:function(){return a},IK:function(){return d},MU:function(){return l},OV:function(){return s},RE:function(){return h},Vo:function(){return p},Yd:function(){return u},h$:function(){return n},w9:function(){return v},xL:function(){return g},y0:function(){return c}});e(74423),e(3362);var r=e(62384),i=e(47351);const s=async o=>{(0,r.v)(o.config.version,2021,2,4)?await o.callWS({type:"supervisor/api",endpoint:"/supervisor/reload",method:"post"}):await o.callApi("POST","hassio/supervisor/reload")},a=async o=>(0,r.v)(o.config.version,2021,2,4)?o.callWS({type:"supervisor/api",endpoint:"/supervisor/info",method:"get"}):(0,i.PS)(await o.callApi("GET","hassio/supervisor/info")),l=async o=>(0,r.v)(o.config.version,2021,2,4)?o.callWS({type:"supervisor/api",endpoint:"/info",method:"get"}):(0,i.PS)(await o.callApi("GET","hassio/info")),n=async o=>o.callApi("GET","hassio/host/logs/boots"),d=async(o,t)=>o.callApi("GET",`hassio/${t.includes("_")?`addons/${t}`:t}/logs`),h=async(o,t,e,r=0)=>o.callApiRaw("GET",`hassio/${t.includes("_")?`addons/${t}`:t}/logs${0!==r?`/boots/${r}`:""}`,void 0,e?{Range:e}:void 0),c=async(o,t,e,r=100,i=0)=>o.callApiRaw("GET",`hassio/${t.includes("_")?`addons/${t}`:t}/logs${0!==i?`/boots/${i}`:""}/follow?lines=${r}`,void 0,void 0,e),g=async(o,t,e,r,i,s=100,a=0)=>o.callApiRaw("GET",`hassio/${t.includes("_")?`addons/${t}`:t}/logs${0!==a?`/boots/${a}`:""}/follow`,void 0,{Range:`entries=${r}:${i}:${s}`},e),p=o=>`/api/hassio/${o.includes("_")?`addons/${o}`:o}/logs`,u=(o,t,e=0)=>`/api/hassio/${o.includes("_")?`addons/${o}`:o}/logs${0!==e?`/boots/${e}`:""}?lines=${t}`,v=async(o,t)=>{(0,r.v)(o.config.version,2021,2,4)?await o.callWS({type:"supervisor/api",endpoint:"/supervisor/options",method:"post",data:t}):await o.callApi("POST","hassio/supervisor/options",t)}},22828:function(o,t,e){e.a(o,async function(o,t){try{e(16280),e(94490),e(26910),e(18111),e(22489),e(61701),e(3362),e(27495),e(25440),e(42762),e(62953);var r=e(40445),i=(e(68825),e(5124)),s=e(6412),a=e(35463),l=e(67576),n=(e(34296),e(38962)),d=(e(57781),e(18350)),h=(e(76776),e(29823)),c=(e(70947),e(26300)),g=e(65829),p=(e(67094),e(82e3)),u=e(36312),v=e(62384),_=e(1087),b=e(9899),f=e(70555),w=e(47351),m=e(90600),C=e(30039),y=e(97153),k=o([n,d,h,c,g]);[n,d,h,c,g]=k.then?(await k)():k;let S,$,L,x,T,H,A,E,V,M,P,B,R,O,Z,q=o=>o;const I="M19.92,12.08L12,20L4.08,12.08L5.5,10.67L11,16.17V2H13V16.17L18.5,10.66L19.92,12.08M12,20H2V22H22V20H12Z",U="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",F="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",z="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",W="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",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",D="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",X="M16,7H3V5H16V7M3,19H16V17H3V19M22,12L18,9V11H3V13H18V15L22,12Z",K=100;class Q extends i.WF{render(){const o=this._streamSupported&&this.provider&&(0,u.x)(this.hass.config,"hassio")&&"loading"!==this._loadingState,t=this._streamSupported&&Array.isArray(this._boots),e=this.localizeFunc||this.hass.localize;return(0,i.qy)(S||(S=q` <div class="error-log-intro"> ${0} <ha-card outlined> <div class="header"> <h1 class="card-header"> ${0} </h1> <div class="action-buttons"> ${0} <ha-icon-button .path="${0}" @click="${0}" .label="${0}"></ha-icon-button> <ha-icon-button .path="${0}" @click="${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}" size="small" appearance="filled" @click="${0}"> <ha-svg-icon .path="${0}" slot="start"></ha-svg-icon> ${0} <ha-svg-icon .path="${0}" slot="end"></ha-svg-icon> </ha-button> ${0} </ha-card> </div> `),this._error?(0,i.qy)($||($=q`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):i.s6,this.header||e("ui.panel.config.logs.show_full_logs"),t&&this._showBootsSelect?(0,i.qy)(L||(L=q` <ha-dropdown @wa-select="${0}"> <ha-assist-chip slot="trigger" .title="${0}" .label="${0}"> <ha-svg-icon slot="trailing-icon" .path="${0}"></ha-svg-icon></ha-assist-chip> ${0} </ha-dropdown> `),this._handleOverflowAction,e("ui.panel.config.logs.haos_boots_title"),0===this._boot?e("ui.panel.config.logs.current"):-1===this._boot?e("ui.panel.config.logs.previous"):e("ui.panel.config.logs.startups_ago",{boot:-1*this._boot}),N,this._boots.map(o=>(0,i.qy)(x||(x=q` <ha-dropdown-item .value="${0}" .selected="${0}"> ${0} </ha-dropdown-item> ${0} `),`boot_${o}`,o===this._boot,0===o?e("ui.panel.config.logs.current"):-1===o?e("ui.panel.config.logs.previous"):e("ui.panel.config.logs.startups_ago",{boot:-1*o}),0===o?(0,i.qy)(T||(T=q`<wa-divider></wa-divider>`)):i.s6))):i.s6,z,this._downloadLogs,e("ui.panel.config.logs.download_logs"),this._wrapLines?X:D,this._toggleLineWrap,e("ui.panel.config.logs."+(this._wrapLines?"full_width":"wrap_lines")),!o||this._error?(0,i.qy)(H||(H=q`<ha-icon-button .path="${0}" @click="${0}" .label="${0}"></ha-icon-button>`),j,this._handleRefresh,e("ui.common.refresh")):i.s6,this.allowSwitch&&"core"===this.provider||t?(0,i.qy)(A||(A=q` <ha-dropdown @wa-select="${0}"> <ha-icon-button slot="trigger" .path="${0}" .label="${0}"></ha-icon-button> ${0} ${0} </ha-dropdown> `),this._handleOverflowAction,F,e("ui.common.menu"),this.allowSwitch&&"core"===this.provider?(0,i.qy)(E||(E=q`<ha-dropdown-item value="switch-log-view"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item>`),W,this.hass.localize("ui.panel.config.logs.show_condensed_logs")):i.s6,t?(0,i.qy)(V||(V=q`<ha-dropdown-item value="toggle-boots"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item>`),G,e(`ui.panel.config.logs.${this._showBootsSelect?"hide":"show"}_haos_boots`)):i.s6):i.s6,"loading"===this._loadingPrevState?(0,i.qy)(M||(M=q`<div class="loading-old"> <ha-spinner></ha-spinner> </div>`)):i.s6,"loading"===this._loadingState?(0,i.qy)(P||(P=q`<div>${0}</div>`),e("ui.panel.config.logs.loading_log")):"empty"===this._loadingState?(0,i.qy)(B||(B=q`<div>${0}</div>`),e("ui.panel.config.logs.no_errors")):i.s6,"loaded"===this._loadingState&&this.filter&&this._noSearchResults?(0,i.qy)(R||(R=q`<div> ${0} </div>`),e("ui.panel.config.logs.no_issues_search",{term:this.filter})):i.s6,!this._wrapLines,(0,s.H)({visible:this._newLogsIndicator&&!this._scrolledToBottomController.value||!1}),this._scrollToBottom,I,e("ui.panel.config.logs.scroll_down_button"),I,o&&0===this._boot&&!this._error?(0,i.qy)(O||(O=q`<div class="live-indicator"> <ha-svg-icon path="${0}"></ha-svg-icon> Live </div>`),U):i.s6)}willUpdate(o){super.willUpdate(o),this.hasUpdated||(this._streamSupported=(0,v.v)(this.hass.config.version,2024,11),this._loadBoots(),window.addEventListener("connection-status",this._handleConnectionStatus),this.hass.loadFragmentTranslation("config")),o.has("provider")&&(this._boot=0,this._loadLogs())}firstUpdated(o){super.firstUpdated(o),this._scrolledToBottomController.observe(this._scrollBottomMarkerElement),this._scrolledToTopController.callback=this._handleTopScroll,this._scrolledToTopController.observe(this._scrollTopMarkerElement)}updated(o){super.updated(o),this._newLogsIndicator&&this._scrolledToBottomController.value&&(this._newLogsIndicator=!1),o.has("filter")&&this._debounceSearch(),o.has("_loadingState")&&"loaded"===this._loadingState&&this._scrolledToTopController.value&&this._firstCursor&&!this._loadingPrevState&&this._loadMoreLogs()}disconnectedCallback(){super.disconnectedCallback(),this._logStreamAborter&&this._logStreamAborter.abort(),window.removeEventListener("connection-status",this._handleConnectionStatus)}async _downloadLogs(){if(this._streamSupported&&this.provider)(0,y.$)(this,{header:this.header,provider:this.provider,defaultLineCount:this._numberOfLines,boot:this._boot});else{const o=(new Date).toISOString().replace(/:/g,"-"),t=this.provider&&"core"!==this.provider?(0,m.Vo)(this.provider):(0,f._)(this.hass),e=this.provider&&"core"!==this.provider?`${this.provider}_${o}.log`:`home-assistant_${o}.log`,r=await(0,p.e0)(this.hass,t);(0,C.R)(r.path,e)}}async _loadLogs(o=!1){var t,e;(this._error=void 0,this._loadingState="loading",this._numberOfLines=o&&null!==(t=this._numberOfLines)&&void 0!==t?t:0,o)||(this._loadingPrevState=void 0,this._firstCursor=void 0,null===(e=this._ansiToHtmlElement)||void 0===e||e.clear());const r=this._streamSupported&&(0,u.x)(this.hass.config,"hassio")&&this.provider;try{if(this._logStreamAborter&&(this._logStreamAborter.abort(),this._logStreamAborter=void 0),r){if(this._logStreamAborter=new AbortController,!o){const o=await(0,m.RE)(this.hass,this.provider,"entries=:-1:",this._boot);(await o.text()).trim()||(this._loadingState="empty")}let t;if(t=o&&this._firstCursor?await(0,m.xL)(this.hass,this.provider,this._logStreamAborter.signal,this._firstCursor,this._numberOfLines,K,this._boot):await(0,m.y0)(this.hass,this.provider,this._logStreamAborter.signal,K,this._boot),t.headers.has("X-First-Cursor")&&(this._firstCursor=t.headers.get("X-First-Cursor")),!t.body)throw new Error("No stream body found");this._loadingState="empty";let e="";const r=t.body.getReader(),s=new TextDecoder;let a=!1;for(;!a;){const{value:t,done:l}=await r.read();if(a=l,t){const r=s.decode(t,{stream:!a}),l=this._scrolledToBottomController.value,n=`${e}${r}`.split("\n").filter(o=>""!==o.trim());var i;if(e=r.endsWith("\n")?"":n.splice(-1,1)[0],n.length)null===(i=this._ansiToHtmlElement)||void 0===i||i.parseLinesToColoredPre(n),this._numberOfLines+=n.length,"empty"===this._loadingState&&setTimeout(()=>{this._loadingState="loaded"},100);l&&this._logElement?this._scrollToBottom():this._newLogsIndicator=!0,o=!1}}}else{this._streamSupported=!1;let o="";var s;if(o=(0,u.x)(this.hass.config,"hassio")&&this.provider?await(0,m.IK)(this.hass,this.provider):await(0,f.L)(this.hass),o)null===(s=this._ansiToHtmlElement)||void 0===s||s.parseTextToColoredPre(o),this._loadingState="loaded",this._scrollToBottom()}}catch(a){if("AbortError"===a.name)return;if(!o&&r)return void this._loadLogs(!0);this._error=(this.localizeFunc||this.hass.localize)("ui.panel.config.logs.failed_get_logs",{provider:this.provider,error:(0,w.VR)(a)})}}_scrollToBottom(){this._logElement&&(this._newLogsIndicator=!1,"core"!==this.provider?this._logElement.scrollTo(0,this._logElement.scrollHeight):this._debounceScrollToBottom())}async _loadMoreLogs(){if(!this._firstCursor||"loading"===this._loadingPrevState||"loaded"!==this._loadingState||!this._logElement||!this.provider)return;const o=this._scrolledToBottomController.value,t=this._logElement.scrollHeight-this._logElement.scrollTop;this._loadingPrevState="loading";const e=await(0,m.RE)(this.hass,this.provider,`entries=${this._firstCursor}:-100:100`,this._boot);if(e.headers.has("X-First-Cursor")){if(this._firstCursor===e.headers.get("X-First-Cursor"))return void(this._loadingPrevState="end");this._firstCursor=e.headers.get("X-First-Cursor")}const r=await e.text();if(r){var i;const o=r.split("\n").filter(o=>""!==o.trim()).reverse();null===(i=this._ansiToHtmlElement)||void 0===i||i.parseLinesToColoredPre(o,!0),this._numberOfLines+=o.length,this._loadingPrevState="loaded"}else this._loadingPrevState="end";o?this._scrollToBottom():"end"!==this._loadingPrevState&&this._logElement&&window.requestAnimationFrame(()=>{this._logElement.scrollTop=this._logElement.scrollHeight-t})}async _loadBoots(){if(this._streamSupported&&(0,u.x)(this.hass.config,"hassio"))try{const{data:o}=await(0,m.h$)(this.hass),t=Object.keys(o.boots).map(Number).sort((o,t)=>t-o);t.length>1&&(this._boots=t)}catch(o){console.error(o)}}_toggleLineWrap(){this._wrapLines=!this._wrapLines}_handleRefresh(){this._loadLogs()}_handleOverflowAction(o){const t=o.detail.item.value;if(t)if(t.startsWith("boot_"))this._setBoot(Number(t.substring(5)));else switch(t){case"switch-log-view":(0,_.r)(this,"switch-log-view");break;case"toggle-boots":this._showBootsSelect=!this._showBootsSelect}}_setBoot(o){this._boot=o,this._loadLogs()}constructor(...o){super(...o),this.filter="",this.allowSwitch=!1,this._scrolledToBottomController=new a.Q(this,{callback(o){return o[0].isIntersecting}}),this._scrolledToTopController=new a.Q(this,{}),this._loadingState="loading",this._noSearchResults=!1,this._boot=0,this._showBootsSelect=!1,this._wrapLines=!0,this._debounceSearch=(0,b.s)(()=>{var o;this._noSearchResults=!(null!==(o=this._ansiToHtmlElement)&&void 0!==o&&o.filterLines(this.filter)),this.filter||this._scrollToBottom()},150),this._debounceScrollToBottom=(0,b.s)(()=>{this._logElement.scrollTop=this._logElement.scrollHeight},300),this._handleConnectionStatus=o=>{"disconnected"===o.detail&&this._logStreamAborter&&(this._logStreamAborter.abort(),this._loadingState="loading"),"connected"===o.detail&&this._loadLogs(!0)},this._handleTopScroll=o=>{const t=o[0].isIntersecting;return!this._firstCursor||!t||"loaded"!==this._loadingState||this._loadingPrevState&&"loaded"!==this._loadingPrevState||this.filter||this._loadMoreLogs(),t}}}Q.styles=(0,i.AH)(Z||(Z=q`: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, var(--ha-font-size-2xl));letter-spacing:-.012em;line-height:var(--ha-line-height-expanded);display:block;margin-block-start:0px;font-weight:var(--ha-font-weight-normal);white-space:nowrap;max-width:calc(100% - 150px);overflow:hidden;text-overflow:ellipsis}ha-icon-button{float:right}.card-content{margin-top:-8px}.error-log{position:relative;font-family:var(--ha-font-family-code);clear:both;text-align:start;padding-top:16px;padding-bottom:16px;overflow:auto;min-height:var(--error-log-card-height,calc(100vh - 255px));max-height:var(--error-log-card-height,calc(100vh - 255px));border-top:1px solid var(--divider-color);direction:ltr}.error-log>div{overflow:auto;overflow-wrap:break-word}.error-log>div:hover{background-color:var(--secondary-background-color)}.new-logs-indicator{overflow:hidden;position:absolute;bottom:4px;left:4px;height:0;transition:height .4s ease-out}.new-logs-indicator.visible{height:32px}.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}@keyframes 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)}`)),(0,r.Cg)([(0,l.MZ)({attribute:!1})],Q.prototype,"hass",void 0),(0,r.Cg)([(0,l.MZ)({attribute:!1})],Q.prototype,"localizeFunc",void 0),(0,r.Cg)([(0,l.MZ)()],Q.prototype,"filter",void 0),(0,r.Cg)([(0,l.MZ)()],Q.prototype,"header",void 0),(0,r.Cg)([(0,l.MZ)()],Q.prototype,"provider",void 0),(0,r.Cg)([(0,l.MZ)({attribute:"allow-switch",type:Boolean})],Q.prototype,"allowSwitch",void 0),(0,r.Cg)([(0,l.P)(".error-log")],Q.prototype,"_logElement",void 0),(0,r.Cg)([(0,l.P)("#scroll-top-marker")],Q.prototype,"_scrollTopMarkerElement",void 0),(0,r.Cg)([(0,l.P)("#scroll-bottom-marker")],Q.prototype,"_scrollBottomMarkerElement",void 0),(0,r.Cg)([(0,l.P)("ha-ansi-to-html")],Q.prototype,"_ansiToHtmlElement",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_firstCursor",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_scrolledToBottomController",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_scrolledToTopController",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_newLogsIndicator",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_error",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_logStreamAborter",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_streamSupported",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_loadingState",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_loadingPrevState",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_noSearchResults",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_numberOfLines",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_boot",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_boots",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_showBootsSelect",void 0),(0,r.Cg)([(0,l.wk)()],Q.prototype,"_wrapLines",void 0),Q=(0,r.Cg)([(0,l.EM)("error-log-card")],Q),t()}catch(S){t(S)}})},97153:function(o,t,e){e.d(t,{$:function(){return i}});e(3362),e(62953);var r=e(1087);const i=(o,t)=>{(0,r.r)(o,"show-dialog",{dialogTag:"dialog-download-logs",dialogImport:()=>Promise.all([e.e(79064),e.e(13756)]).then(e.bind(e,99063)),dialogParams:t})}},30039:function(o,t,e){e.d(t,{R:function(){return i}});e(62953),e(3296),e(27208),e(48408),e(14603),e(47566),e(98721);var r=e(16869);const i=(o,t="")=>{const e=document.createElement("a");e.target="_blank",e.href=o,e.download=t,e.style.display="none",document.body.appendChild(e),e.dispatchEvent(new MouseEvent("click")),document.body.removeChild(e),o.startsWith("blob:")&&(r.B?setTimeout(()=>URL.revokeObjectURL(o),1e4):URL.revokeObjectURL(o))}}}]);