iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
8 lines • 28.9 kB
JavaScript
export const __webpack_ids__=["5318"];export const __webpack_modules__={64214:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{DG:()=>p,E8:()=>g,Fu:()=>f,NR:()=>b,o0:()=>u,yD:()=>v});var a=n(16485),o=n(27486),r=n(46467),s=n(33570),l=n(11104),d=n(16922),c=e([a,l,r,s]);[a,l,r,s]=c.then?(await c)():c;const u=(e,t,n)=>h(t,n.time_zone).format(e),h=(0,o.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:(0,d.y)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,d.y)(e)?"h12":"h23",timeZone:(0,l.f)(e.time_zone,t)}))),p=((0,o.Z)((()=>new Intl.DateTimeFormat(void 0,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"}))),(e,t,n)=>m(t,n.time_zone).format(e)),m=(0,o.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"short",day:"numeric",hour:(0,d.y)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,d.y)(e)?"h12":"h23",timeZone:(0,l.f)(e.time_zone,t)}))),v=(e,t,n)=>y(t,n.time_zone).format(e),y=(0,o.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{month:"short",day:"numeric",hour:(0,d.y)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,d.y)(e)?"h12":"h23",timeZone:(0,l.f)(e.time_zone,t)}))),f=(e,t,n)=>(new Date).getFullYear()===e.getFullYear()?v(e,t,n):p(e,t,n),g=(e,t,n)=>k(t,n.time_zone).format(e),k=(0,o.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:(0,d.y)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,d.y)(e)?"h12":"h23",timeZone:(0,l.f)(e.time_zone,t)}))),b=(e,t,n)=>`${(0,r.WB)(e,t,n)}, ${(0,s.mr)(e,t,n)}`;i()}catch(e){i(e)}}))},94947:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{G:()=>d});var a=n(16485),o=n(27486),r=n(27046),s=e([a,r]);[a,r]=s.then?(await s)():s;const l=(0,o.Z)((e=>new Intl.RelativeTimeFormat(e.language,{numeric:"auto"}))),d=(e,t,n,i=!0)=>{const a=(0,r.W)(e,n,t);return i?l(t).format(a.value,a.unit):Intl.NumberFormat(t.language,{style:"unit",unit:a.unit,unitDisplay:"long"}).format(Math.abs(a.value))};i()}catch(e){i(e)}}))},11104:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{f:()=>d});var a=n(16485),o=n(20382),r=e([a]);a=(r.then?(await r)():r)[0];const s=Intl.DateTimeFormat?.().resolvedOptions?.().timeZone,l=s??"UTC",d=(e,t)=>e===o.c_.local&&s?l:t;i()}catch(e){i(e)}}))},35830:function(e,t,n){n.d(t,{q:()=>i});const i=e=>{const t=window.location.pathname;return e?t+"?"+e:t}},27046:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{W:()=>u});var a=n(13809),o=n(29558),r=n(94763),s=n(19631);const l=1e3,d=60,c=60*d;function u(e,t=Date.now(),n,i={}){const u={...h,...i||{}},p=(+e-+t)/l;if(Math.abs(p)<u.second)return{value:Math.round(p),unit:"second"};const m=p/d;if(Math.abs(m)<u.minute)return{value:Math.round(m),unit:"minute"};const v=p/c;if(Math.abs(v)<u.hour)return{value:Math.round(v),unit:"hour"};const y=new Date(e),f=new Date(t);y.setHours(0,0,0,0),f.setHours(0,0,0,0);const g=(0,a.j)(y,f);if(0===g)return{value:Math.round(v),unit:"hour"};if(Math.abs(g)<u.day)return{value:g,unit:"day"};const k=(0,s.Bt)(n),b=(0,o.z)(y,{weekStartsOn:k}),w=(0,o.z)(f,{weekStartsOn:k}),_=(0,r.p)(b,w);if(0===_)return{value:g,unit:"day"};if(Math.abs(_)<u.week)return{value:_,unit:"week"};const x=y.getFullYear()-f.getFullYear(),C=12*x+y.getMonth()-f.getMonth();return 0===C?{value:_,unit:"week"}:Math.abs(C)<u.month||0===x?{value:C,unit:"month"}:{value:Math.round(x),unit:"year"}}const h={second:45,minute:45,hour:22,day:5,week:4,month:11};i()}catch(p){i(p)}}))},93262:function(e,t,n){var i=n(44249),a=n(72621),o=(n(9359),n(56475),n(70104),n(87319),n(57243)),r=n(15093),s=n(27486),l=n(36522),d=n(49976),c=n(1416),u=n(58839);n(92824);(0,i.Z)([(0,r.Mo)("ha-blueprint-picker")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,r.Cb)()],key:"value",value:()=>""},{kind:"field",decorators:[(0,r.Cb)()],key:"domain",value:()=>"automation"},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"blueprints",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"method",key:"open",value:function(){const e=this.shadowRoot?.querySelector("ha-select");e&&(e.menuOpen=!0)}},{kind:"field",key:"_processedBlueprints",value(){return(0,s.Z)((e=>{if(!e)return[];return Object.entries(e).filter((e=>!("error"in e[1]))).map((([e,t])=>({...t.metadata,path:e}))).sort(((e,t)=>(0,c.$K)(e.name,t.name,this.hass.locale.language)))}))}},{kind:"method",key:"render",value:function(){return this.hass?o.dy` <ha-select .label="${this.label||this.hass.localize("ui.components.blueprint-picker.select_blueprint")}" fixedMenuPosition naturalMenuWidth .value="${this.value}" .disabled="${this.disabled}" @selected="${this._blueprintChanged}" @closed="${d.U}"> ${this._processedBlueprints(this.blueprints).map((e=>o.dy` <mwc-list-item .value="${e.path}"> ${e.name} </mwc-list-item> `))} </ha-select> `:o.Ld}},{kind:"method",key:"firstUpdated",value:function(e){(0,a.Z)(n,"firstUpdated",this,3)([e]),void 0===this.blueprints&&(0,u.wc)(this.hass,this.domain).then((e=>{this.blueprints=e}))}},{kind:"method",key:"_blueprintChanged",value:function(e){const t=e.target.value;t!==this.value&&(this.value=t,setTimeout((()=>{(0,l.B)(this,"value-changed",{value:t}),(0,l.B)(this,"change")}),0))}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`:host{display:inline-block}ha-select{width:100%;min-width:200px;display:block}`}]}}),o.oi)},75788:function(e,t,n){var i=n(44249),a=n(72621),o=(n(92745),n(9359),n(31526),n(70104),n(92519),n(42179),n(89256),n(24931),n(88463),n(57449),n(19814),n(2060),n(81843),n(57243)),r=n(15093),s=n(36522),l=n(58839),d=n(2357),c=n(28008);n(41307),n(23334),n(48103);(0,i.Z)([(0,r.Mo)("ha-filter-blueprints")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,r.Cb)()],key:"type",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"expanded",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_shouldRender",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_blueprints",value:void 0},{kind:"method",key:"willUpdate",value:function(e){(0,a.Z)(n,"willUpdate",this,3)([e]),this.hasUpdated||this.value?.length&&this._findRelated()}},{kind:"method",key:"render",value:function(){return o.dy` <ha-expansion-panel left-chevron .expanded="${this.expanded}" @expanded-will-change="${this._expandedWillChange}" @expanded-changed="${this._expandedChanged}"> <div slot="header" class="header"> ${this.hass.localize("ui.panel.config.blueprint.caption")} ${this.value?.length?o.dy`<div class="badge">${this.value?.length}</div> <ha-icon-button .path="${"M21 8H3V6H21V8M13.81 16H10V18H13.09C13.21 17.28 13.46 16.61 13.81 16M18 11H6V13H18V11M21.12 15.46L19 17.59L16.88 15.46L15.47 16.88L17.59 19L15.47 21.12L16.88 22.54L19 20.41L21.12 22.54L22.54 21.12L20.41 19L22.54 16.88L21.12 15.46Z"}" @click="${this._clearFilter}"></ha-icon-button>`:o.Ld} </div> ${this._blueprints&&this._shouldRender?o.dy` <mwc-list @selected="${this._blueprintsSelected}" multi class="ha-scrollbar"> ${Object.entries(this._blueprints).map((([e,t])=>"error"in t?o.Ld:o.dy`<ha-check-list-item .value="${e}" .selected="${(this.value||[]).includes(e)}"> ${t.metadata.name||e} </ha-check-list-item>`))} </mwc-list> `:o.Ld} </ha-expansion-panel> `}},{kind:"method",key:"firstUpdated",value:async function(){this.type&&(this._blueprints=await(0,l.wc)(this.hass,this.type))}},{kind:"method",key:"updated",value:function(e){e.has("expanded")&&this.expanded&&setTimeout((()=>{!this.narrow&&this.expanded&&(this.renderRoot.querySelector("mwc-list").style.height=this.clientHeight-49+"px")}),300)}},{kind:"method",key:"_expandedWillChange",value:function(e){this._shouldRender=e.detail.expanded}},{kind:"method",key:"_expandedChanged",value:function(e){this.expanded=e.detail.expanded}},{kind:"method",key:"_blueprintsSelected",value:async function(e){const t=this._blueprints;if(!e.detail.index.size)return(0,s.B)(this,"data-table-filter-changed",{value:[],items:void 0}),void(this.value=[]);const n=[];for(const i of e.detail.index){const e=Object.keys(t)[i];n.push(e)}this.value=n,this._findRelated()}},{kind:"method",key:"_findRelated",value:async function(){if(!this.value?.length)return(0,s.B)(this,"data-table-filter-changed",{value:[],items:void 0}),void(this.value=[]);const e=[];for(const t of this.value)this.type&&e.push((0,d.K)(this.hass,`${this.type}_blueprint`,t));const t=await Promise.all(e),n=new Set;for(const e of t)e[this.type]&&e[this.type].forEach((e=>n.add(e)));(0,s.B)(this,"data-table-filter-changed",{value:this.value,items:this.type?n:void 0})}},{kind:"method",key:"_clearFilter",value:function(e){e.preventDefault(),this.value=void 0,(0,s.B)(this,"data-table-filter-changed",{value:void 0,items:void 0})}},{kind:"get",static:!0,key:"styles",value:function(){return[c.$c,o.iv`:host{border-bottom:1px solid var(--divider-color)}:host([expanded]){flex:1;height:0}ha-expansion-panel{--ha-card-border-radius:0;--expansion-panel-content-padding:0}.header{display:flex;align-items:center}.header ha-icon-button{margin-inline-start:auto;margin-inline-end:8px}.badge{display:inline-block;margin-left:8px;margin-inline-start:8px;margin-inline-end:0;min-width:16px;box-sizing:border-box;border-radius:50%;font-weight:400;font-size:11px;background-color:var(--primary-color);line-height:16px;text-align:center;padding:0px 2px;color:var(--text-primary-color)}`]}}]}}),o.oi)},53013:function(e,t,n){var i=n(44249),a=n(72621),o=(n(9359),n(56475),n(70104),n(48136),n(57243)),r=n(15093),s=n(94886),l=n.n(s),d=n(36522),c=(n(75656),n(50100),n(18084),n(75351));let u;const h=new(n(80262).L)(1e3),p={reType:/(?<input>(\[!(?<type>caution|important|note|tip|warning)\])(?:\s|\\n)?)/i,typeToHaAlert:{caution:"error",important:"info",note:"info",tip:"success",warning:"warning"}};(0,i.Z)([(0,r.Mo)("ha-markdown-element")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)()],key:"content",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:"allow-svg",type:Boolean})],key:"allowSvg",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"breaks",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,attribute:"lazy-images"})],key:"lazyImages",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"cache",value:()=>!1},{kind:"method",key:"disconnectedCallback",value:function(){if((0,a.Z)(i,"disconnectedCallback",this,3)([]),this.cache){const e=this._computeCacheKey();h.set(e,this.innerHTML)}}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"update",value:function(e){(0,a.Z)(i,"update",this,3)([e]),void 0!==this.content&&this._render()}},{kind:"method",key:"willUpdate",value:function(e){if(!this.innerHTML&&this.cache){const e=this._computeCacheKey();h.has(e)&&(this.innerHTML=h.get(e),this._resize())}}},{kind:"method",key:"_computeCacheKey",value:function(){return l()({content:this.content,allowSvg:this.allowSvg,breaks:this.breaks})}},{kind:"method",key:"_render",value:async function(){this.innerHTML=await(async(e,t,i)=>(u||(u=(0,c.Ud)(new Worker(new URL(n.p+n.u("45845"),n.b)))),u.renderMarkdown(e,t,i)))(String(this.content),{breaks:this.breaks,gfm:!0},{allowSvg:this.allowSvg}),this._resize();const e=document.createTreeWalker(this,NodeFilter.SHOW_ELEMENT,null);for(;e.nextNode();){const t=e.currentNode;if(t instanceof HTMLAnchorElement&&t.host!==document.location.host)t.target="_blank",t.rel="noreferrer noopener";else if(t instanceof HTMLImageElement)this.lazyImages&&(t.loading="lazy"),t.addEventListener("load",this._resize);else if(t instanceof HTMLQuoteElement){const n=t.firstElementChild?.firstChild?.textContent&&p.reType.exec(t.firstElementChild.firstChild.textContent);if(n){const{type:i}=n.groups,a=document.createElement("ha-alert");a.alertType=p.typeToHaAlert[i.toLowerCase()],a.append(...Array.from(t.childNodes).map((e=>{const t=Array.from(e.childNodes);if(!this.breaks&&t.length){const e=t[0];e.nodeType===Node.TEXT_NODE&&e.textContent===n.input&&e.textContent?.includes("\n")&&(e.textContent=e.textContent.split("\n").slice(1).join("\n"))}return t})).reduce(((e,t)=>e.concat(t)),[]).filter((e=>e.textContent&&e.textContent!==n.input))),e.parentNode().replaceChild(a,t)}}else t instanceof HTMLElement&&["ha-alert","ha-qr-code","ha-icon","ha-svg-icon"].includes(t.localName)&&n(23265)(`./${t.localName}`)}}},{kind:"field",key:"_resize",value(){return()=>(0,d.B)(this,"content-resize")}}]}}),o.fl)},99254:function(e,t,n){var i=n(44249),a=n(57243),o=n(15093);n(53013);(0,i.Z)([(0,o.Mo)("ha-markdown")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)()],key:"content",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"allow-svg",type:Boolean})],key:"allowSvg",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"breaks",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"lazy-images"})],key:"lazyImages",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"cache",value:()=>!1},{kind:"method",key:"render",value:function(){return this.content?a.dy`<ha-markdown-element .content="${this.content}" .allowSvg="${this.allowSvg}" .breaks="${this.breaks}" .lazyImages="${this.lazyImages}" .cache="${this.cache}"></ha-markdown-element>`:a.Ld}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`:host{display:block}ha-markdown-element{-ms-user-select:text;-webkit-user-select:text;-moz-user-select:text}ha-markdown-element>:first-child{margin-top:0}ha-markdown-element>:last-child{margin-bottom:0}ha-alert{display:block;margin:4px 0}a{color:var(--primary-color)}img{max-width:100%}code,pre{background-color:var(--markdown-code-background-color,none);border-radius:3px}svg{background-color:var(--markdown-svg-background-color,none);color:var(--markdown-svg-color,none)}code{font-size:85%;padding:.2em .4em}pre code{padding:0}pre{padding:16px;overflow:auto;line-height:1.45;font-family:var(--code-font-family, monospace)}h1,h2,h3,h4,h5,h6{line-height:initial}h2{font-size:1.5em;font-weight:700}hr{border-color:var(--divider-color);border-bottom:none;margin:16px 0}`}]}}),a.oi)},17170:function(e,t,n){n.a(e,(async function(e,i){try{n.r(t),n.d(t,{HaSpinner:()=>u});var a=n(44249),o=n(72621),r=n(97677),s=n(43580),l=n(57243),d=n(15093),c=e([r]);r=(c.then?(await c)():c)[0];let u=(0,a.Z)([(0,d.Mo)("ha-spinner")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,d.Cb)()],key:"size",value:void 0},{kind:"method",key:"updated",value:function(e){if((0,o.Z)(n,"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:()=>[s.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)}`]}]}}),r.Z);i()}catch(e){i(e)}}))},4573:function(e,t,n){var i=n(44249),a=n(72621),o=n(92264),r=n(57243),s=n(15093);(0,i.Z)([(0,s.Mo)("ha-sub-menu")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"method",key:"show",value:async function(){(0,a.Z)(n,"show",this,3)([]),this.menu.hasOverflow=!1}},{kind:"field",static:!0,key:"styles",value(){return[...(0,a.Z)(n,"styles",this),r.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)}`]}}]}}),o.f)},58839:function(e,t,n){n.d(t,{Bp:()=>o,E2:()=>s,Uk:()=>l,Zt:()=>r,fQ:()=>a,wc:()=>i});const i=(e,t)=>e.callWS({type:"blueprint/list",domain:t}),a=(e,t)=>e.callWS({type:"blueprint/import",url:t}),o=(e,t,n,i,a,o)=>e.callWS({type:"blueprint/save",domain:t,path:n,yaml:i,source_url:a,allow_override:o}),r=(e,t,n)=>e.callWS({type:"blueprint/delete",domain:t,path:n}),s=e=>{const t=e.metadata.source_url;return t?t.includes("github.com/home-assistant")?"homeassistant":"community":"local"},l=(e,t,n,i)=>e.callWS({type:"blueprint/substitute",domain:t,path:n,input:i})},12068:function(e,t,n){n.d(t,{B:()=>i,l:()=>a});n(9359),n(31526),n(92519),n(42179),n(89256),n(24931),n(88463),n(57449),n(19814);const i=e=>{const t={};return Object.entries(e).forEach((([e,n])=>{t[e]={value:n.value,items:n.items instanceof Set?Array.from(n.items):n.items}})),t},a=e=>{const t={};return Object.entries(e).forEach((([e,n])=>{t[e]={value:n.value,items:Array.isArray(n.items)?new Set(n.items):n.items}})),t}},40027:function(e,t,n){n.d(t,{C:()=>a});var i=n(22337);const a=e=>class extends e{constructor(...e){super(...e),this._handleClick=async e=>{const t=e.composedPath()[0];if(!(0,i.J)(e))return;if(await this.promptDiscardChanges()&&(this._removeListeners(),t)){const n=new MouseEvent(e.type,e);t.dispatchEvent(n)}},this._handleUnload=e=>e.preventDefault()}_removeListeners(){window.removeEventListener("click",this._handleClick,!0),window.removeEventListener("beforeunload",this._handleUnload)}willUpdate(e){super.willUpdate(e),this.isDirty?(window.addEventListener("click",this._handleClick,!0),window.addEventListener("beforeunload",this._handleUnload)):this._removeListeners()}disconnectedCallback(){super.disconnectedCallback(),this._removeListeners()}get isDirty(){return!1}async promptDiscardChanges(){return!0}}},61107:function(e,t,n){n.d(t,{E:()=>o,O:()=>a});var i=n(36522);const a=()=>Promise.all([n.e("46379"),n.e("66031"),n.e("72206"),n.e("97983"),n.e("24199"),n.e("27506"),n.e("42950"),n.e("65505"),n.e("58640"),n.e("83423"),n.e("18865"),n.e("27090"),n.e("88975"),n.e("3049"),n.e("21876"),n.e("89790"),n.e("61843"),n.e("15626")]).then(n.bind(n,2711)),o=(e,t)=>{(0,i.B)(e,"show-dialog",{dialogTag:"dialog-area-registry-detail",dialogImport:a,dialogParams:t})}},61751:function(e,t,n){n.d(t,{q:()=>o});var i=n(36522);const a=()=>Promise.all([n.e("7010"),n.e("40728"),n.e("9387")]).then(n.bind(n,19456)),o=(e,t)=>{(0,i.B)(e,"show-dialog",{dialogTag:"ha-dialog-automation-mode",dialogImport:a,dialogParams:t})}},11432:function(e,t,n){n.d(t,{h:()=>o});var i=n(36522);const a=()=>Promise.all([n.e("89790"),n.e("92212")]).then(n.bind(n,61179)),o=(e,t)=>{(0,i.B)(e,"show-dialog",{dialogTag:"ha-dialog-automation-save",dialogImport:a,dialogParams:t})}},31694:function(e,t,n){n.d(t,{X:()=>o});var i=n(36522);const a=()=>n.e("87395").then(n.bind(n,21940)),o=(e,t)=>{(0,i.B)(e,"show-dialog",{dialogTag:"ha-dialog-new-automation",dialogImport:a,dialogParams:t})}},33831:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{k:()=>h});var a=n(44249),o=n(72621),r=(n(9359),n(70104),n(52924),n(31622),n(57243)),s=n(15093),l=n(36522),d=(n(93262),n(54977),n(17170)),c=(n(99254),n(66671),n(30509),n(28008)),u=e([d]);d=(u.then?(await u)():u)[0];let h=(0,a.Z)([(0,s.Mo)("blueprint-generic-editor")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"is-wide",type:Boolean})],key:"isWide",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,s.SB)()],key:"_blueprints",value:void 0},{kind:"method",key:"firstUpdated",value:function(e){(0,o.Z)(n,"firstUpdated",this,3)([e]),this._getBlueprints()}},{kind:"get",key:"_blueprint",value:function(){if(this._blueprints)return this._blueprints[this._config.use_blueprint.path]}},{kind:"method",key:"renderCard",value:function(){const e=this._blueprint;let t=!0;return r.dy` <ha-card outlined class="blueprint" .header="${this.hass.localize("ui.panel.config.automation.editor.blueprint.header")}"> <div class="blueprint-picker-container"> ${this._blueprints?Object.keys(this._blueprints).length?r.dy` <ha-blueprint-picker .hass="${this.hass}" .label="${this.hass.localize("ui.panel.config.automation.editor.blueprint.blueprint_to_use")}" .blueprints="${this._blueprints}" .value="${this._config.use_blueprint.path}" .disabled="${this.disabled}" @value-changed="${this._blueprintChanged}"></ha-blueprint-picker> `:this.hass.localize("ui.panel.config.automation.editor.blueprint.no_blueprints"):r.dy`<ha-spinner></ha-spinner>`} </div> ${this._config.use_blueprint.path?e&&"error"in e?r.dy`<p class="warning padding"> There is an error in this Blueprint: ${e.error} </p>`:r.dy`${e?.metadata.description?r.dy`<ha-markdown class="card-content" breaks .content="${e.metadata.description}"></ha-markdown>`:""} ${e?.metadata?.input&&Object.keys(e.metadata.input).length?Object.entries(e.metadata.input).map((([e,n])=>{if(n&&"input"in n){const i=this._renderSection(e,n);return t=!1,i}const i=this._renderSettingRow(e,n,t);return t=!0,i})):r.dy`<p class="padding"> ${this.hass.localize("ui.panel.config.automation.editor.blueprint.no_inputs")} </p>`}`:""} </ha-card> `}},{kind:"method",key:"_renderSection",value:function(e,t){const n=t?.name||e,i=t.input&&Object.values(t.input).some((e=>null===e||void 0===e.default)),a=!t.collapsed||i;return r.dy`<ha-expansion-panel outlined .expanded="${a}" .noCollapse="${i}"> ${t?.icon?r.dy` <ha-icon slot="leading-icon" class="section-header" .icon="${t.icon}"></ha-icon> `:r.Ld} <div slot="header" role="heading" aria-level="3" class="section-header"> <ha-markdown .content="${n}"></ha-markdown> </div> <div class="content"> ${t?.description?r.dy`<ha-markdown .content="${t.description}"></ha-markdown>`:r.Ld} ${t.input?Object.entries(t.input).map((([e,t])=>this._renderSettingRow(e,t,!0))):r.Ld} </div> </ha-expansion-panel>`}},{kind:"method",key:"_renderSettingRow",value:function(e,t,n){const i=t?.selector??{text:void 0};return r.dy`<ha-settings-row .narrow="${this.narrow}" class="${n?"border":""}"> <span slot="heading">${t?.name||e}</span> <ha-markdown slot="description" class="card-content" breaks .content="${t?.description}"></ha-markdown> ${r.dy`<ha-selector .hass="${this.hass}" .selector="${i}" .key="${e}" .disabled="${this.disabled}" .required="${void 0===t?.default}" .placeholder="${t?.default}" .value="${this._config.use_blueprint.input&&e in this._config.use_blueprint.input?this._config.use_blueprint.input[e]:t?.default}" @value-changed="${this._inputChanged}"></ha-selector>`} </ha-settings-row>`}},{kind:"method",key:"_blueprintChanged",value:function(e){e.stopPropagation(),this._config.use_blueprint.path!==e.detail.value&&(0,l.B)(this,"value-changed",{value:{...this._config,use_blueprint:{path:e.detail.value}}})}},{kind:"method",key:"_inputChanged",value:function(e){e.stopPropagation();const t=e.target,n=t.key,i=e.detail?e.detail.value:t.value;if(this._config.use_blueprint.input&&this._config.use_blueprint.input[n]===i||!this._config.use_blueprint.input&&""===i)return;const a={...this._config.use_blueprint.input,[n]:i};(0,l.B)(this,"value-changed",{value:{...this._config,use_blueprint:{...this._config.use_blueprint,input:a}}})}},{kind:"get",static:!0,key:"styles",value:function(){return[c.Qx,r.iv`:host{display:block}ha-card.blueprint{margin:0 auto;margin-bottom:64px}.padding{padding:16px}.link-button-row{padding:14px}.blueprint-picker-container{padding:0 16px 16px}ha-blueprint-picker,ha-textfield{display:block}h3{margin:16px}.introduction{margin-top:0;margin-bottom:12px}.introduction a{color:var(--primary-color)}p{margin-bottom:0}.description{margin-bottom:16px}ha-settings-row{--paper-time-input-justify-content:flex-end;--settings-row-content-width:100%;--settings-row-prefix-display:contents}ha-settings-row.border{border-top:1px solid var(--divider-color)}ha-expansion-panel{margin:8px;margin-left:8px;margin-right:8px}div.section-header{display:flex;vertical-align:middle}ha-icon.section-header{padding-right:10px}ha-alert{display:block;margin-bottom:16px}`]}}]}}),r.oi);i()}catch(e){i(e)}}))},80262:function(e,t,n){n.d(t,{L:()=>i});class i{constructor(e){this._expiration=void 0,this._cache=new Map,this._expiration=e}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t),this._expiration&&window.setTimeout((()=>this._cache.delete(e)),this._expiration)}has(e){return this._cache.has(e)}}},23265:function(e,t,n){var i={"./ha-icon":["65981","97406"],"./ha-icon-button-toggle":["79505","80175"],"./ha-svg-icon":["37583"],"./ha-icon-button-group":["45747","97792"],"./ha-svg-icon.ts":["37583"],"./ha-icon.ts":["65981","97406"],"./ha-icon-overflow-menu":["59959","91552","78456","56898","99287","35252"],"./ha-icon-next":["13928","99172"],"./ha-icon-picker":["21393","46379","66031","24199","27506","97077"],"./ha-qr-code.ts":["50634","53750","70472"],"./ha-icon-button-arrow-prev.ts":["54202","41069"],"./ha-icon-button-arrow-prev":["54202","41069"],"./ha-icon-overflow-menu.ts":["59959","91552","78456","56898","99287","35252"],"./ha-alert":["99426","4809"],"./ha-icon-button-next":["4635","51577"],"./ha-icon-button":["23334"],"./ha-icon-button-next.ts":["4635","51577"],"./ha-icon-picker.ts":["21393","46379","66031","24199","27506","97077"],"./ha-icon-button-group.ts":["45747","97792"],"./ha-icon-button-toggle.ts":["79505","80175"],"./ha-icon-button-arrow-next.ts":["54237","21559"],"./ha-icon-button-prev.ts":["5828","43537"],"./ha-icon-prev":["95499","87557"],"./ha-icon-prev.ts":["95499","87557"],"./ha-icon-button.ts":["23334"],"./ha-alert.ts":["99426","4809"],"./ha-icon-button-prev":["5828","43537"],"./ha-qr-code":["50634","53750","70472"],"./ha-icon-next.ts":["13928","99172"],"./ha-icon-button-arrow-next":["54237","21559"]};function a(e){if(!n.o(i,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],a=t[0];return Promise.all(t.slice(1).map(n.e)).then((function(){return n(a)}))}a.keys=()=>Object.keys(i),a.id=23265,e.exports=a},68783:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{A:()=>c});var a=n(64699),o=n(15073),r=n(81048),s=n(31027),l=n(57243),d=e([o]);o=(d.then?(await d)():d)[0];var c=class extends s.P{constructor(){super(...arguments),this.localize=new o.V(this)}render(){return l.dy` <svg part="base" class="spinner" role="progressbar" aria-label="${this.localize.term("loading")}"> <circle class="spinner__track"></circle> <circle class="spinner__indicator"></circle> </svg> `}};c.styles=[r.N,a.D],i()}catch(e){i(e)}}))},64699:function(e,t,n){n.d(t,{D:()=>i});var i=n(57243).iv`:host{--track-width:2px;--track-color:rgb(128 128 128 / 25%);--indicator-color:var(--sl-color-primary-600);--speed:2s;display:inline-flex;width:1em;height:1em;flex:none}.spinner{flex:1 1 auto;height:100%;width:100%}.spinner__indicator,.spinner__track{fill:none;stroke-width:var(--track-width);r:calc(0.5em - var(--track-width)/ 2);cx:0.5em;cy:0.5em;transform-origin:50% 50%}.spinner__track{stroke:var(--track-color);transform-origin:0% 0%}.spinner__indicator{stroke:var(--indicator-color);stroke-linecap:round;stroke-dasharray:150% 75%;animation:spin var(--speed) linear infinite}@keyframes spin{0%{transform:rotate(0deg);stroke-dasharray:0.05em,3em}50%{transform:rotate(450deg);stroke-dasharray:1.375em,1.375em}100%{transform:rotate(1080deg);stroke-dasharray:0.05em,3em}}`},97677:function(e,t,n){n.a(e,(async function(e,i){try{n.d(t,{Z:()=>a.A});var a=n(68783),o=(n(64699),n(15073)),r=n(21262),s=(n(81048),n(31027),n(52812),e([o,r,a]));[o,r,a]=s.then?(await s)():s,i()}catch(e){i(e)}}))},43580:function(e,t,n){n.d(t,{Z:()=>i.D});var i=n(64699);n(52812)},94763:function(e,t,n){n.d(t,{p:()=>o});var i=n(34151),a=n(13809);function o(e,t,n){const o=(0,a.j)(e,t,n)/7;return(0,i.u)(n?.roundingMethod)(o)}}};
//# sourceMappingURL=5318.9a340be33584e550.js.map