${this.hass.localize("ui.common.delete")}
- `}renderSlots(){const e=parseFloat(getComputedStyle(this).getPropertyValue("width")),t=86400/(this.rangeMax-this.rangeMin)*e;let i=-this.rangeMin/(this.rangeMax-this.rangeMin)*e;return this.slots.map((s,a)=>{const o=((Ue(s.stop,this.hass)||86400)-Ue(s.start,this.hass))/86400,n=this.computeActionDisplay(s)||"",r=5*(n||"").length+10,l=i<0&&i+o*t>0?5-i:15,d=i+o*t>e&&i{const o=((Ue(s.stop,this.hass)||86400)-Ue(s.start,this.hass))/86400,n=this.computeActionDisplay(s)||"",r=5*(n||"").length+10,l=i<0&&i+o*t>0?5-i:15,c=i+o*t>e&&i0?this.renderTooltip(a):""}
-
- ${n&&(c>r/3||c>50)&&c>30?n:""}
+
+ ${n&&(d>r/3||d>50)&&d>30?n:""}
`})}renderTooltip(e){const t=Be(this.slots[e].start);return N`
@@ -622,7 +622,7 @@ class _a extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
${t?"":oa(na(Ve(3600*e)),it(this.hass))}
- `})}computeActionDisplay(e){if(this.hass)return e.actions?Ze(e.actions.map(e=>{const t=this.actions.find(t=>Us(t,e,!0));return t?t.variables&&Object.keys(t.variables).some(t=>e.service_data&&t in e.service_data)?Object.entries(t.variables).filter(([t])=>e.service_data&&t in e.service_data).map(([t,i])=>{const s=e.service_data[t];if(i.type==_t.Level)return i=i,St(Number(s),i);if(i.type==_t.List){const e=(i=i).options.find(e=>e.value==s);return Qe(e&&e.name?e.name:String(s))}return""}).join(", "):Qe(t.name||Es("services."+e.service,it(this.hass))||e.service):"???"})).join(", "):""}_handleTouchStart(e){const t=parseFloat(getComputedStyle(this).getPropertyValue("width")),i=86400/(this.rangeMax-this.rangeMin)*t,s=-(-this.rangeMin/(this.rangeMax-this.rangeMin)*t)/i*86400,a=e.target;let o=a;for(;!o.classList.contains("slot");)o=o.parentElement;const n=o,r=n.previousElementSibling,l=Number(r.getAttribute("slot")),d=l>0?Ue(this.slots[l].start,this.hass)+60*this.stepSize:0,c=l
{let a;a="undefined"!=typeof TouchEvent&&e instanceof TouchEvent?e.changedTouches[0].pageX:e.pageX;let o=a-u.left;o>t-10&&(o=t-10),o<10&&(o=10);let n=Math.round(o/i*86400+s);nc&&(n=c),this.currentTime=n;const r=Be(this.slots[l].stop);let h;r?h=Va(Ve(n),r.event,this.hass,{stepSize:this.stepSize}):(n=Math.round(n)>=86400?86400:He(n,this.stepSize),h=Ve(n)),h!=this.slots[l].stop&&(this.slots=Object.assign(this.slots,{[l]:Object.assign(Object.assign({},this.slots[l]),{stop:h}),[l+1]:Object.assign(Object.assign({},this.slots[l+1]),{start:h})}),this.requestUpdate())};const m=()=>{window.removeEventListener("mousemove",h),window.removeEventListener("touchmove",h),window.removeEventListener("mouseup",m),window.removeEventListener("touchend",m),window.removeEventListener("blur",m),h=()=>{},setTimeout(()=>{this.isDragging=!1},100),a.blur();const e=new CustomEvent("update",{detail:{entries:this.slots}});this.dispatchEvent(e)};window.addEventListener("mouseup",m),window.addEventListener("touchend",m),window.addEventListener("blur",m),window.addEventListener("mousemove",h),window.addEventListener("touchmove",h)}_selectSlot(e){if(this.isDragging)return;let t=e.target;"span"==t.tagName.toLowerCase()&&(t=t.parentElement),t.classList.contains("handle")&&(t=t.parentElement);const i=Number(t.getAttribute("slot"));this.activeSlot==i&&null===this.activeMarker?(this.activeSlot=null,this.previousSlot=null):(this.previousSlot=this.activeSlot,this.activeSlot=i),this.activeMarker=null,this._updateZoom();const s=new CustomEvent("update",{detail:{entry:this.activeSlot}});this.dispatchEvent(s)}_calculateZoom(){const e=Number(this.activeSlot);let t=Ue(this.slots[e].start,this.hass),i=Ue(this.slots[e].stop,this.hass)||86400;t-=(i-t)/3,i+=(i-t)/3,(i-t)/86400*parseFloat(getComputedStyle(this).getPropertyValue("width"))>=100?(t=0,i=86400):(t<0&&(i-=t),i>86400&&(t-=i-86400)),this.rangeMin=t>0?t:0,this.rangeMax=i<86400?i:86400,clearInterval(this.timer),clearTimeout(this.timeout),this.timer=window.setInterval(()=>{this._updateTooltips()},50),this.timeout=window.setTimeout(()=>{clearInterval(this.timer),this._updateTooltips()},230)}_addSlot(){if(null===this.activeSlot)return;const e=this.slots[this.activeSlot],t=Ue(e.start,this.hass);let i=Ue(e.stop,this.hass);i{const i=e.offsetWidth,s=e.parentElement.offsetLeft+e.offsetLeft-t;return e.parentElement.classList.contains("left")?[s+i/2,s+3*i/2]:e.parentElement.classList.contains("right")?[s-i/2,s+i/2]:[s,s+i]};null==s||s.forEach((e,o)=>{const n=e.parentElement,r=n.classList.contains("visible"),l=Number(n.parentElement.getAttribute("slot"));if(l!=this.activeSlot&&l-1!=this.activeSlot)r&&n.classList.remove("visible");else{const d=e.parentElement.offsetLeft;if(d<0||d>i+2*t)r&&n.classList.remove("visible");else{r||n.classList.add("visible");const t=n.offsetWidth,d=n.classList.contains("center");let c=a(e)[0],u=i-a(e)[1];if(o>0&&l-1==this.activeSlot)c-=a(s[o-1])[1];else if(o+1t/2&&(n.classList.add("right"),n.classList.remove("center"),n.classList.remove("left")):(n.classList.add("center"),n.classList.remove("right"),n.classList.remove("left")):u<0?d&&c>t/2&&(n.classList.add("left"),n.classList.remove("center"),n.classList.remove("right")):(n.classList.add("center"),n.classList.remove("left"),n.classList.remove("right"))}}})}_updateZoom(){clearInterval(this.timer),clearTimeout(this.timeout),this.timer=window.setInterval(()=>{this._updateTooltips()},50),this.timeout=window.setTimeout(()=>{clearInterval(this.timer),this._updateTooltips()},230)}_selectMarker(e,t=!0){e.stopImmediatePropagation();let i=e.target;for(;!i.classList.contains("slot");)i=i.parentElement;const s=Number(i.getAttribute("slot"));t&&this.activeMarker===s?this.activeMarker=null:this.activeMarker=t?s:null;const a=new CustomEvent("update",{detail:{entry:this.activeSlot,marker:this.activeMarker}});this.dispatchEvent(a),this._updateTooltips()}static get styles(){return r`
+ `})}computeActionDisplay(e){if(this.hass)return e.actions?Ze(e.actions.map(e=>{const t=this.actions.find(t=>Us(t,e,!0));return t?t.variables&&Object.keys(t.variables).some(t=>e.service_data&&t in e.service_data)?Object.entries(t.variables).filter(([t])=>e.service_data&&t in e.service_data).map(([t,i])=>{const s=e.service_data[t];if(i.type==_t.Level)return i=i,St(Number(s),i);if(i.type==_t.List){const e=(i=i).options.find(e=>e.value==s);return Qe(e&&e.name?e.name:String(s))}return""}).join(", "):Qe(t.name||Es("services."+e.service,it(this.hass))||e.service):"???"})).join(", "):""}_handleTouchStart(e){const t=parseFloat(getComputedStyle(this).getPropertyValue("width")),i=86400/(this.rangeMax-this.rangeMin)*t,s=-(-this.rangeMin/(this.rangeMax-this.rangeMin)*t)/i*86400,a=e.target;let o=a;for(;!o.classList.contains("slot");)o=o.parentElement;const n=o,r=n.previousElementSibling,l=Number(r.getAttribute("slot")),c=l>0?Ue(this.slots[l].start,this.hass)+60*this.stepSize:0,d=l{let a;a="undefined"!=typeof TouchEvent&&e instanceof TouchEvent?e.changedTouches[0].pageX:e.pageX;let o=a-u.left;o>t-10&&(o=t-10),o<10&&(o=10);let n=Math.round(o/i*86400+s);nd&&(n=d),this.currentTime=n;const r=Be(this.slots[l].stop);let h;r?h=Ha(Ve(n),r.event,this.hass,{stepSize:this.stepSize}):(n=Math.round(n)>=86400?86400:He(n,this.stepSize),h=Ve(n)),h!=this.slots[l].stop&&(this.slots=Object.assign(this.slots,{[l]:Object.assign(Object.assign({},this.slots[l]),{stop:h}),[l+1]:Object.assign(Object.assign({},this.slots[l+1]),{start:h})}),this.requestUpdate())};const m=()=>{window.removeEventListener("mousemove",h),window.removeEventListener("touchmove",h),window.removeEventListener("mouseup",m),window.removeEventListener("touchend",m),window.removeEventListener("blur",m),h=()=>{},setTimeout(()=>{this.isDragging=!1},100),a.blur();const e=new CustomEvent("update",{detail:{entries:this.slots}});this.dispatchEvent(e)};window.addEventListener("mouseup",m),window.addEventListener("touchend",m),window.addEventListener("blur",m),window.addEventListener("mousemove",h),window.addEventListener("touchmove",h)}_selectSlot(e){if(this.isDragging)return;let t=e.target;"span"==t.tagName.toLowerCase()&&(t=t.parentElement),t.classList.contains("handle")&&(t=t.parentElement);const i=Number(t.getAttribute("slot"));this.activeSlot==i&&null===this.activeMarker?(this.activeSlot=null,this.previousSlot=null):(this.previousSlot=this.activeSlot,this.activeSlot=i),this.activeMarker=null,this._updateZoom();const s=new CustomEvent("update",{detail:{entry:this.activeSlot}});this.dispatchEvent(s)}_calculateZoom(){const e=Number(this.activeSlot);let t=Ue(this.slots[e].start,this.hass),i=Ue(this.slots[e].stop,this.hass)||86400;t-=(i-t)/3,i+=(i-t)/3,(i-t)/86400*parseFloat(getComputedStyle(this).getPropertyValue("width"))>=100?(t=0,i=86400):(t<0&&(i-=t),i>86400&&(t-=i-86400)),this.rangeMin=t>0?t:0,this.rangeMax=i<86400?i:86400,clearInterval(this.timer),clearTimeout(this.timeout),this.timer=window.setInterval(()=>{this._updateTooltips()},50),this.timeout=window.setTimeout(()=>{clearInterval(this.timer),this._updateTooltips()},230)}_addSlot(){if(null===this.activeSlot)return;const e=this.slots[this.activeSlot],t=Ue(e.start,this.hass);let i=Ue(e.stop,this.hass);i{const i=e.offsetWidth,s=e.parentElement.offsetLeft+e.offsetLeft-t;return e.parentElement.classList.contains("left")?[s+i/2,s+3*i/2]:e.parentElement.classList.contains("right")?[s-i/2,s+i/2]:[s,s+i]};null==s||s.forEach((e,o)=>{const n=e.parentElement,r=n.classList.contains("visible"),l=Number(n.parentElement.getAttribute("slot"));if(l!=this.activeSlot&&l-1!=this.activeSlot)r&&n.classList.remove("visible");else{const c=e.parentElement.offsetLeft;if(c<0||c>i+2*t)r&&n.classList.remove("visible");else{r||n.classList.add("visible");const t=n.offsetWidth,c=n.classList.contains("center");let d=a(e)[0],u=i-a(e)[1];if(o>0&&l-1==this.activeSlot)d-=a(s[o-1])[1];else if(o+1t/2&&(n.classList.add("right"),n.classList.remove("center"),n.classList.remove("left")):(n.classList.add("center"),n.classList.remove("right"),n.classList.remove("left")):u<0?c&&d>t/2&&(n.classList.add("left"),n.classList.remove("center"),n.classList.remove("right")):(n.classList.add("center"),n.classList.remove("left"),n.classList.remove("right"))}}})}_updateZoom(){clearInterval(this.timer),clearTimeout(this.timeout),this.timer=window.setInterval(()=>{this._updateTooltips()},50),this.timeout=window.setTimeout(()=>{clearInterval(this.timer),this._updateTooltips()},230)}_selectMarker(e,t=!0){e.stopImmediatePropagation();let i=e.target;for(;!i.classList.contains("slot");)i=i.parentElement;const s=Number(i.getAttribute("slot"));t&&this.activeMarker===s?this.activeMarker=null:this.activeMarker=t?s:null;const a=new CustomEvent("update",{detail:{entry:this.activeSlot,marker:this.activeMarker}});this.dispatchEvent(a),this._updateTooltips()}static get styles(){return r`
:host {
display: block;
max-width: 100%;
@@ -827,12 +827,12 @@ class _a extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
mwc-button ha-icon {
margin-right: 11px;
}
- `}};t([ae()],Ba.prototype,"hass",void 0),t([ae({type:Array})],Ba.prototype,"slots",void 0),t([ae({type:Array})],Ba.prototype,"actions",void 0),t([ae({type:Number})],Ba.prototype,"stepSize",void 0),t([ae()],Ba.prototype,"rangeMin",void 0),t([ae()],Ba.prototype,"rangeMax",void 0),t([ae()],Ba.prototype,"activeSlot",void 0),t([ae()],Ba.prototype,"activeMarker",void 0),t([ae({type:Boolean})],Ba.prototype,"large",void 0),t([function(e){return ne({finisher:(t,i)=>{Object.assign(t.prototype[i],e)}})}
+ `}};t([ae()],Fa.prototype,"hass",void 0),t([ae({type:Array})],Fa.prototype,"slots",void 0),t([ae({type:Array})],Fa.prototype,"actions",void 0),t([ae({type:Number})],Fa.prototype,"stepSize",void 0),t([ae()],Fa.prototype,"rangeMin",void 0),t([ae()],Fa.prototype,"rangeMax",void 0),t([ae()],Fa.prototype,"activeSlot",void 0),t([ae()],Fa.prototype,"activeMarker",void 0),t([ae({type:Boolean})],Fa.prototype,"large",void 0),t([function(e){return ne({finisher:(t,i)=>{Object.assign(t.prototype[i],e)}})}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
- */({passive:!0})],Ba.prototype,"_handleTouchStart",null),Ba=t([ie("timeslot-editor")],Ba);const Fa=async()=>{if(customElements.get("ha-checkbox")&&customElements.get("ha-slider")&&customElements.get("ha-combo-box"))return;await customElements.whenDefined("partial-panel-resolver");const e=document.createElement("partial-panel-resolver");e.hass={panels:[{url_path:"tmp",component_name:"config"}]},e._updateRoutes(),await e.routerOptions.routes.tmp.load(),await customElements.whenDefined("ha-panel-config");const t=document.createElement("ha-panel-config");await t.routerOptions.routes.automation.load()};let Ya=class extends ee{constructor(){super(...arguments),this.min=0,this.max=255,this.step=1,this.scaleFactor=1,this.unit="",this.optional=!1,this.disabled=!1,this._displayedValue=0}set value(e){e=isNaN(e)?this.min:this._roundedValue(e/this.scaleFactor),this._displayedValue=e}firstUpdated(){(async()=>{await Fa()})(),this.disabled&&!this.optional&&(this.disabled=!1,this.requestUpdate())}render(){return N`
+ */({passive:!0})],Fa.prototype,"_handleTouchStart",null),Fa=t([ie("timeslot-editor")],Fa);const Ya=async()=>{if(customElements.get("ha-checkbox")&&customElements.get("ha-slider")&&customElements.get("ha-combo-box"))return;await customElements.whenDefined("partial-panel-resolver");const e=document.createElement("partial-panel-resolver");e.hass={panels:[{url_path:"tmp",component_name:"config"}]},e._updateRoutes(),await e.routerOptions.routes.tmp.load(),await customElements.whenDefined("ha-panel-config");const t=document.createElement("ha-panel-config");await t.routerOptions.routes.automation.load()};let Wa=class extends ee{constructor(){super(...arguments),this.min=0,this.max=255,this.step=1,this.scaleFactor=1,this.unit="",this.optional=!1,this.disabled=!1,this._displayedValue=0}set value(e){e=isNaN(e)?this.min:this._roundedValue(e/this.scaleFactor),this._displayedValue=e}firstUpdated(){(async()=>{await Ya()})(),this.disabled&&!this.optional&&(this.disabled=!1,this.requestUpdate())}render(){return N`
${this.getCheckbox()}
@@ -864,14 +864,14 @@ class _a extends class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t
>
`}getCheckbox(){return this.optional?N`
- `:N``}toggleChecked(e){const t=e.target.checked;this.disabled=!t;const i=this.disabled?null:this._scaledValue(this._displayedValue);Te(this,"value-changed",{value:i})}_updateValue(e){let t=Number(e.target.value);this._displayedValue=t,t=this._scaledValue(this._displayedValue),Te(this,"value-changed",{value:t})}_roundedValue(e){return e=Math.round(e/this.step)*this.step,(e=parseFloat(e.toPrecision(12)))>this.max?e=this.max:e
this.max?e=this.max:e
`}renderTextVariable(){const e=this.variable,t=this.value;return N`
- `}};Wa.styles=r`
+ `}};Za.styles=r`
ha-textfield {
width: 100%;
}
- `,t([ae()],Wa.prototype,"variable",void 0),t([ae()],Wa.prototype,"value",void 0),Wa=t([ie("scheduler-variable-picker")],Wa);let Za=class extends ee{constructor(){super(...arguments),this.activeEntry=null,this.activeMarker=null,this.timeslots=!1,this.editItem=!1,this.large=!1}firstUpdated(){if(!this.actions||!this.hass)return;this.timeslots||(this.activeEntry=0);const e=this.actions.map(e=>{const t=Object.assign(Object.assign({},e),{service_data:Ye(e.service_data||{},...Object.keys(e.variables||{}))});return Object.assign(e,{name:Ks(t)})});e.sort(Je),this.actions=e}shouldUpdate(e){return e.get("schedule")&&this.dispatchEvent(new CustomEvent("change",{detail:{schedule:this.schedule}})),!0}render(){return this.hass&&this.config&&this.entities&&this.actions?N`
+ `,t([ae()],Za.prototype,"variable",void 0),t([ae()],Za.prototype,"value",void 0),Za=t([ie("scheduler-variable-picker")],Za);let Ga=class extends ee{constructor(){super(...arguments),this.activeEntry=null,this.activeMarker=null,this.timeslots=!1,this.editItem=!1,this.large=!1}firstUpdated(){if(!this.actions||!this.hass)return;this.timeslots||(this.activeEntry=0);const e=this.actions.map(e=>{const t=Object.assign(Object.assign({},e),{service_data:Ye(e.service_data||{},...Object.keys(e.variables||{}))});return Object.assign(e,{name:Ks(t)})});e.sort(Je),this.actions=e}shouldUpdate(e){return e.get("schedule")&&this.dispatchEvent(new CustomEvent("change",{detail:{schedule:this.schedule}})),!0}render(){return this.hass&&this.config&&this.entities&&this.actions?N`