UNPKG

iobroker.lovelace

Version:

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

11 lines 30.9 kB
export const __webpack_ids__=["31664"];export const __webpack_modules__={60370:function(o,e,t){var i=t(44249),r=t(72621),s=t(10445),a=t(57243),n=t(15093);(0,i.Z)([(0,n.Mo)("ha-assist-chip")],(function(o,e){class t extends e{constructor(...e){super(...e),o(this)}}return{F:t,d:[{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"filled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"active",value:()=>!1},{kind:"field",static:!0,key:"styles",value(){return[...(0,r.Z)(t,"styles",this),a.iv`: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?a.dy`<span class="filled"></span>`:(0,r.Z)(t,"renderOutline",this,3)([])}},{kind:"method",key:"getContainerClasses",value:function(){return{...(0,r.Z)(t,"getContainerClasses",this,3)([]),active:this.active}}},{kind:"method",key:"renderPrimaryContent",value:function(){return a.dy` <span class="leading icon" aria-hidden="true"> ${this.renderLeadingIcon()} </span> <span class="label">${this.label}</span> <span class="touch"></span> <span class="trailing leading icon" aria-hidden="true"> ${this.renderTrailingIcon()} </span> `}},{kind:"method",key:"renderTrailingIcon",value:function(){return a.dy`<slot name="trailing-icon"></slot>`}}]}}),s.X)},69546:function(o,e,t){var i=t(44249),r=t(72621),s=(t(92745),t(9359),t(31526),t(57243)),a=t(15093),n=t(35359);(0,i.Z)([(0,a.Mo)("ha-ansi-to-html")],(function(o,e){class t extends e{constructor(...e){super(...e),o(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:()=>!1},{kind:"field",decorators:[(0,a.IO)("pre")],key:"_pre",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_filter",value:()=>""},{kind:"method",key:"render",value:function(){return s.dy`<pre class="${(0,n.$)({wrap:!this.wrapDisabled})}"></pre>`}},{kind:"method",key:"firstUpdated",value:function(o){(0,r.Z)(t,"firstUpdated",this,3)([o]),this.content&&this.parseTextToColoredPre(this.content)}},{kind:"field",static:!0,key:"styles",value:()=>s.iv`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(o,e=!1){for(const t of o)this.parseLineToColoredPre(t,e)}},{kind:"method",key:"parseLineToColoredPre",value:function(o,e=!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=o=>{const e=document.createElement("span");s.bold&&e.classList.add("bold"),s.italic&&e.classList.add("italic"),s.underline&&e.classList.add("underline"),s.strikethrough&&e.classList.add("strikethrough"),null!==s.foregroundColor&&e.classList.add(`fg-${s.foregroundColor}`),null!==s.backgroundColor&&e.classList.add(`bg-${s.backgroundColor}`),e.appendChild(document.createTextNode(o)),t.appendChild(e)};let n;for(;null!==(n=i.exec(o));){const e=n.index,t=o.substring(r,e);t&&a(t),r=e+n[0].length,void 0!==n[1]&&n[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 l=o.substring(r);l&&a(l),e?(this._pre?.prepend(t),t.animate([{opacity:0},{opacity:1}],{duration:500})):this._pre?.appendChild(t),this._filter&&this.filterLines(this._filter)}},{kind:"method",key:"parseTextToColoredPre",value:function(o){const e=o.split("\n");for(const o of e)this.parseLineToColoredPre(o)}},{kind:"method",key:"filterLines",value:function(o){this._filter=o;const e=this.shadowRoot?.querySelectorAll("div")||[];let t=0;if(o){const i=[];e.forEach((e=>{if(e.textContent?.toLowerCase().includes(o.toLowerCase())){if(e.style.display="",t++,CSS.highlights&&null!==e.firstChild&&e.textContent){e.querySelectorAll("span").forEach((e=>{const t=e.textContent.toLowerCase(),r=[];let s=0;for(;s<t.length;){const e=t.indexOf(o.toLowerCase(),s);if(-1===e)break;r.push(e),s=e+o.length}r.forEach((t=>{const r=new Range;r.setStart(e.firstChild,t),r.setEnd(e.firstChild,t+o.length),i.push(r)}))}))}}else e.style.display="none"})),CSS.highlights&&CSS.highlights.set("search-results",new Highlight(...i))}else e.forEach((o=>{o.style.display=""})),t=e.length,CSS.highlights&&CSS.highlights.delete("search-results");return!!t}},{kind:"method",key:"clear",value:function(){this._pre&&(this._pre.innerHTML="")}}]}}),s.oi)},51868:function(o,e,t){var i=t(44249),r=t(72621),s=t(1231),a=t(57243),n=t(15093);(0,i.Z)([(0,n.Mo)("ha-md-divider")],(function(o,e){class t extends e{constructor(...e){super(...e),o(this)}}return{F:t,d:[{kind:"field",static:!0,key:"styles",value(){return[...(0,r.Z)(t,"styles",this),a.iv`:host{--md-divider-color:var(--divider-color)}`]}}]}}),s.B)},7843:function(o,e,t){var i=t(44249),r=t(72621),s=t(28674),a=t(57243),n=t(15093);(0,i.Z)([(0,n.Mo)("ha-md-menu-item")],(function(o,e){class t extends e{constructor(...e){super(...e),o(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),a.iv`: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(o,e,t){var i=t(44249),r=t(72621),s=t(53336),a=t(7162),n=t(57243),l=t(15093);(0,i.Z)([(0,l.Mo)("ha-menu")],(function(o,e){class t extends e{constructor(...e){super(...e),o(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(o){o.detail.reason.kind===a.GB.KEYDOWN&&o.detail.reason.key===a.KC.ESCAPE||o.detail.initiator.clickAction?.(o.detail.initiator)}},{kind:"field",static:!0,key:"styles",value(){return[...(0,r.Z)(t,"styles",this),n.iv`:host{--md-sys-color-surface-container:var(--card-background-color)}`]}}]}}),s.xX)},17170:function(o,e,t){t.a(o,(async function(o,i){try{t.r(e),t.d(e,{HaSpinner:()=>h});var r=t(44249),s=t(72621),a=t(97677),n=t(43580),l=t(57243),d=t(15093),c=o([a]);a=(c.then?(await c)():c)[0];let h=(0,r.Z)([(0,d.Mo)("ha-spinner")],(function(o,e){class t extends e{constructor(...e){super(...e),o(this)}}return{F:t,d:[{kind:"field",decorators:[(0,d.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(o){if((0,s.Z)(t,"updated",this,3)([o]),o.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:()=>[n.Z,l.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)}`]}]}}),a.Z);i()}catch(o){i(o)}}))},75951:function(o,e,t){t.d(e,{G:()=>i,l:()=>r});const i=o=>o.callApi("GET","error_log"),r="/api/error_log"},56785:function(o,e,t){t.d(e,{js:()=>s,rY:()=>r,yd:()=>l,yz:()=>n});t(92519),t(42179),t(89256),t(24931),t(88463),t(57449),t(19814);if(99387==t.j)var i=t(17803);const r=o=>o.data,s=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,a=new Set([502,503,504]),n=o=>!!(o&&o.status_code&&a.has(o.status_code))||!(!o||!o.message||!o.message.includes("ERR_CONNECTION_CLOSED")&&!o.message.includes("ERR_CONNECTION_RESET")),l=async(o,e)=>(0,i.I)(o.config.version,2021,2,4)?o.callWS({type:"supervisor/api",endpoint:`/${e}/stats`,method:"get"}):r(await o.callApi("GET",`hassio/${e}/stats`))},79960:function(o,e,t){if(t.d(e,{Bq:()=>g,CP:()=>a,KQ:()=>l,Lm:()=>n,NC:()=>c,Ri:()=>h,gM:()=>p,jP:()=>v,lC:()=>s,rM:()=>u,wt:()=>d}),99387==t.j)var i=t(17803);var r=t(56785);const s=async o=>{(0,i.I)(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,i.I)(o.config.version,2021,2,4)?o.callWS({type:"supervisor/api",endpoint:"/supervisor/info",method:"get"}):(0,r.rY)(await o.callApi("GET","hassio/supervisor/info")),n=async o=>(0,i.I)(o.config.version,2021,2,4)?o.callWS({type:"supervisor/api",endpoint:"/info",method:"get"}):(0,r.rY)(await o.callApi("GET","hassio/info")),l=async o=>o.callApi("GET","hassio/host/logs/boots"),d=async(o,e)=>o.callApi("GET",`hassio/${e.includes("_")?`addons/${e}`:e}/logs`),c=async(o,e,t,i=0)=>o.callApiRaw("GET",`hassio/${e.includes("_")?`addons/${e}`:e}/logs${0!==i?`/boots/${i}`:""}`,void 0,t?{Range:t}:void 0),h=async(o,e,t,i=100,r=0)=>o.callApiRaw("GET",`hassio/${e.includes("_")?`addons/${e}`:e}/logs${0!==r?`/boots/${r}`:""}/follow?lines=${i}`,void 0,void 0,t),u=async(o,e,t,i,r,s=100,a=0)=>o.callApiRaw("GET",`hassio/${e.includes("_")?`addons/${e}`:e}/logs${0!==a?`/boots/${a}`:""}/follow`,void 0,{Range:`entries=${i}:${r}:${s}`},t),p=o=>`/api/hassio/${o.includes("_")?`addons/${o}`:o}/logs`,g=(o,e,t=0)=>`/api/hassio/${o.includes("_")?`addons/${o}`:o}/logs${0!==t?`/boots/${t}`:""}?lines=${e}`,v=async(o,e)=>{(0,i.I)(o.config.version,2021,2,4)?await o.callWS({type:"supervisor/api",endpoint:"/supervisor/options",method:"post",data:e}):await o.callApi("POST","hassio/supervisor/options",e)}},74713:function(o,e,t){t.a(o,(async function(o,e){try{var i=t(44249),r=t(72621),s=(t(9359),t(56475),t(70104),t(87319),t(57243)),a=t(35359),n=t(19301),l=t(15093),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(72344),m=t(22381),k=t(64145),b=o([d]);d=(b.then?(await b)():b)[0];const y="M19.92,12.08L12,20L4.08,12.08L5.5,10.67L11,16.17V2H13V16.17L18.5,10.66L19.92,12.08M12,20H2V22H22V20H12Z",_="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",w="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",C="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",S="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",x="M7,10L12,15L17,10H7Z",L="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",$="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",T="M16,7H3V5H16V7M3,19H16V17H3V19M22,12L18,9V11H3V13H18V15L22,12Z",H="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",A=100;(0,i.Z)([(0,l.Mo)("error-log-card")],(function(o,e){class t extends e{constructor(...e){super(...e),o(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:()=>""},{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:()=>!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:o=>o[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:()=>"loading"},{kind:"field",decorators:[(0,l.SB)()],key:"_loadingPrevState",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_noSearchResults",value:()=>!1},{kind:"field",decorators:[(0,l.SB)()],key:"_numberOfLines",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_boot",value:()=>0},{kind:"field",decorators:[(0,l.SB)()],key:"_boots",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_showBootsSelect",value:()=>!1},{kind:"field",decorators:[(0,l.SB)()],key:"_wrapLines",value:()=>!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 o=this._streamSupported&&this.provider&&(0,f.p)(this.hass,"hassio")&&"loading"!==this._loadingState,e=this._streamSupported&&Array.isArray(this._boots),t=this.localizeFunc||this.hass.localize;return s.dy` <div class="error-log-intro"> ${this._error?s.dy`<ha-alert alert-type="error">${this._error}</ha-alert>`:s.Ld} <ha-card outlined> <div class="header"> <h1 class="card-header"> ${this.header||t("ui.panel.config.logs.show_full_logs")} </h1> <div class="action-buttons"> ${e&&this._showBootsSelect?s.dy` <ha-assist-chip .title="${t("ui.panel.config.logs.haos_boots_title")}" .label="${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})}" id="boots-anchor" @click="${this._toggleBootsMenu}"> <ha-svg-icon slot="trailing-icon" .path="${x}"></ha-svg-icon></ha-assist-chip> <ha-menu anchor="boots-anchor" id="boots-menu" positioning="fixed"> ${this._boots.map((o=>s.dy` <ha-md-menu-item .value="${o}" @click="${this._setBoot}" .selected="${o===this._boot}"> ${0===o?t("ui.panel.config.logs.current"):-1===o?t("ui.panel.config.logs.previous"):t("ui.panel.config.logs.startups_ago",{boot:-1*o})} </ha-md-menu-item> ${0===o?s.dy`<ha-md-divider role="separator"></ha-md-divider>`:s.Ld} `))} </ha-menu> `:s.Ld} ${this._downloadSupported?s.dy` <ha-icon-button .path="${C}" @click="${this._downloadLogs}" .label="${t("ui.panel.config.logs.download_logs")}"></ha-icon-button> `:this._logsFileLink?s.dy` <a href="${this._logsFileLink}" target="_blank" class="download-link"> <ha-icon-button .path="${C}" .label="${t("ui.panel.config.logs.download_logs")}"></ha-icon-button> </a> `:s.Ld} <ha-icon-button .path="${this._wrapLines?T:$}" @click="${this._toggleLineWrap}" .label="${t("ui.panel.config.logs."+(this._wrapLines?"full_width":"wrap_lines"))}"></ha-icon-button> ${!o||this._error?s.dy`<ha-icon-button .path="${L}" @click="${this._loadLogs}" .label="${t("ui.common.refresh")}"></ha-icon-button>`:s.Ld} ${this.allowSwitch&&"core"===this.provider||e?s.dy` <ha-button-menu @action="${this._handleOverflowAction}"> <ha-icon-button slot="trigger" .path="${_}"> </ha-icon-button> ${this.allowSwitch&&"core"===this.provider?s.dy`<ha-list-item graphic="icon"> <ha-svg-icon slot="graphic" .path="${H}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.logs.show_condensed_logs")} </ha-list-item>`:s.Ld} ${e?s.dy`<ha-list-item graphic="icon"> <ha-svg-icon slot="graphic" .path="${S}"></ha-svg-icon> ${t(`ui.panel.config.logs.${this._showBootsSelect?"hide":"show"}_haos_boots`)} </ha-list-item>`:s.Ld} </ha-button-menu> `:s.Ld} </div> </div> <div class="card-content error-log"> <div id="scroll-top-marker"></div> ${"loading"===this._loadingPrevState?s.dy`<div class="loading-old"> <ha-spinner></ha-spinner> </div>`:s.Ld} ${"loading"===this._loadingState?s.dy`<div>${t("ui.panel.config.logs.loading_log")}</div>`:"empty"===this._loadingState?s.dy`<div>${t("ui.panel.config.logs.no_errors")}</div>`:s.Ld} ${"loaded"===this._loadingState&&this.filter&&this._noSearchResults?s.dy`<div> ${t("ui.panel.config.logs.no_issues_search",{term:this.filter})} </div>`:s.Ld} <ha-ansi-to-html ?wrap-disabled="${!this._wrapLines}"></ha-ansi-to-html> <div id="scroll-bottom-marker"></div> </div> <ha-button class="new-logs-indicator ${(0,a.$)({visible:this._newLogsIndicator&&!this._scrolledToBottomController.value||!1})}" @click="${this._scrollToBottom}"> <ha-svg-icon .path="${y}" slot="icon"></ha-svg-icon> ${t("ui.panel.config.logs.scroll_down_button")} <ha-svg-icon .path="${y}" slot="trailingIcon"></ha-svg-icon> </ha-button> ${o&&0===this._boot&&!this._error?s.dy`<div class="live-indicator"> <ha-svg-icon path="${w}"></ha-svg-icon> Live </div>`:s.Ld} </ha-card> </div> `}},{kind:"method",key:"willUpdate",value:function(o){(0,r.Z)(t,"willUpdate",this,3)([o]),this.hasUpdated||(this._downloadSupported=(0,g.G)(this.hass),this._streamSupported=!0,this._loadBoots(),window.addEventListener("connection-status",this._handleConnectionStatus),this.hass.loadFragmentTranslation("config")),o.has("provider")&&(this._boot=0,this._loadLogs())}},{kind:"method",key:"firstUpdated",value:function(o){(0,r.Z)(t,"firstUpdated",this,3)([o]),this._scrolledToBottomController.observe(this._scrollBottomMarkerElement),this._scrolledToTopController.callback=this._handleTopScroll,this._scrolledToTopController.observe(this._scrollTopMarkerElement)}},{kind:"method",key:"updated",value:function(o){(0,r.Z)(t,"updated",this,3)([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()}},{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 o=(new Date).toISOString().replace(/:/g,"-"),e=this.provider&&"core"!==this.provider?(0,p.gM)(this.provider):h.l,t=this.provider&&"core"!==this.provider?`${this.provider}_${o}.log`:`home-assistant_${o}.log`,i=await(0,c.iI)(this.hass,e);(0,g.N)(i.path,t)}}},{kind:"method",key:"_loadLogs",value:async function(o=!1){this._error=void 0,this._loadingState="loading",this._numberOfLines=o?this._numberOfLines??0:0,o||(this._loadingPrevState=void 0,this._firstCursor=void 0,this._ansiToHtmlElement?.clear());const e=this._streamSupported&&(0,f.p)(this.hass,"hassio")&&this.provider;try{if(this._logStreamAborter&&(this._logStreamAborter.abort(),this._logStreamAborter=void 0),e){if(this._logStreamAborter=new AbortController,!o){const o=await(0,p.NC)(this.hass,this.provider,"entries=:-1:",this._boot);(await o.text()).trim()||(this._loadingState="empty")}let e;if(e=o&&this._firstCursor?await(0,p.rM)(this.hass,this.provider,this._logStreamAborter.signal,this._firstCursor,this._numberOfLines,A,this._boot):await(0,p.Ri)(this.hass,this.provider,this._logStreamAborter.signal,A,this._boot),e.headers.has("X-First-Cursor")&&(this._firstCursor=e.headers.get("X-First-Cursor")),!e.body)throw new Error("No stream body found");this._loadingState="empty";let t="";const i=e.body.getReader(),r=new TextDecoder;let s=!1;for(;!s;){const{value:e,done:a}=await i.read();if(s=a,e){const i=r.decode(e,{stream:!s}),a=this._scrolledToBottomController.value,n=`${t}${i}`.split("\n").filter((o=>""!==o.trim()));if(t=i.endsWith("\n")?"":n.splice(-1,1)[0],n.length&&(this._ansiToHtmlElement?.parseLinesToColoredPre(n),this._numberOfLines+=n.length,"empty"===this._loadingState&&setTimeout((()=>{this._loadingState="loaded"}),100)),a&&this._logElement?this._scrollToBottom():this._newLogsIndicator=!0,!this._downloadSupported){const o=(0,p.Bq)(this.provider,this._numberOfLines,this._boot);(0,c.iI)(this.hass,o).then((o=>{this._logsFileLink=o.path}))}o=!1}}}else{this._streamSupported=!1;let o="";o=(0,f.p)(this.hass,"hassio")&&this.provider?await(0,p.wt)(this.hass,this.provider):await(0,h.G)(this.hass),o&&(this._ansiToHtmlElement?.parseTextToColoredPre(o),this._loadingState="loaded",this._scrollToBottom())}}catch(t){if("AbortError"===t.name)return;if(!o&&e)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)(t)})}}},{kind:"field",key:"_debounceSearch",value(){return(0,m.D)((()=>{this._noSearchResults=!this._ansiToHtmlElement?.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 o=>{"disconnected"===o.detail&&this._logStreamAborter&&(this._logStreamAborter.abort(),this._loadingState="loading"),"connected"===o.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 o=this._scrolledToBottomController.value,e=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){const o=i.split("\n").filter((o=>""!==o.trim())).reverse();this._ansiToHtmlElement?.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-e}))}},{kind:"field",key:"_handleTopScroll",value(){return o=>{const e=o[0].isIntersecting;return!this._firstCursor||!e||"loaded"!==this._loadingState||this._loadingPrevState&&"loaded"!==this._loadingPrevState||this.filter||this._loadMoreLogs(),e}}},{kind:"method",key:"_loadBoots",value:async function(){if(this._streamSupported&&(0,f.p)(this.hass,"hassio"))try{const{data:o}=await(0,p.KQ)(this.hass),e=Object.keys(o.boots).map(Number).sort(((o,e)=>e-o));e.length>1&&(this._boots=e)}catch(o){console.error(o)}}},{kind:"method",key:"_toggleLineWrap",value:function(){this._wrapLines=!this._wrapLines}},{kind:"method",key:"_handleOverflowAction",value:function(o){let e=o.detail.index;switch("core"===this.provider&&e--,e){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(o){this._boot=o.target.value,this._loadLogs()}},{kind:"field",static:!0,key:"styles",value:()=>s.iv`: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}@media 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}@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)}`}]}}),s.oi);e()}catch(o){e(o)}}))},64145:function(o,e,t){t.d(e,{X:()=>r});var i=t(36522);const r=(o,e)=>{(0,i.B)(o,"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:e})}},58014:function(o,e,t){t.d(e,{N:()=>r,G:()=>s});var i=t(18117);const r=(o,e="")=>{const t=document.createElement("a");t.target="_blank",t.href=o,t.download=e,t.style.display="none",document.body.appendChild(t),t.dispatchEvent(new MouseEvent("click")),document.body.removeChild(t)},s=o=>!(o=>!!o.auth.external&&i.G)(o)||!!o.auth.external?.config.downloadFileSupported},18117:function(o,e,t){t.d(e,{G:()=>i});const i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}; //# sourceMappingURL=31664.91f8f67f01c25ef7.js.map