Files
homeassistant_espscreen/screen_manager/app/static/assets/index-Cj3m_z3Z.js
T
Max Gramser bdb1f12c55 Draw a tile on the editor's mockup the way the screen does: the CYD shows the whole tile again (0.2.76)
Both boards draw a normal tile with the icon on the left and the name and value beside it;
the Vue editor stacked icon, name and value in one column. On a CYD mockup a tile is 47 px
high and that stack needed 58 px (63 for a watch card), so the value line was cut in half and
a big value hid the name. A single tile is now a row (.head: icon + .tx), a watch card puts
the name row on top and the number under it, and the small slider runs underneath; on a CYD
a tile with a slider uses the screen's 4 px padding and 8 px slider. The Guition mockup
follows the screen the same way.

App 0.2.76, firmware stays 0.2.63. Test results in docs/TEST_RESULTS_0276.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 09:56:01 +02:00

29 lines
218 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function Wo(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const xe={},un=[],xt=()=>{},ul=()=>!1,Ns=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Rs=e=>e.startsWith("onUpdate:"),He=Object.assign,Ko=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Ba=Object.prototype.hasOwnProperty,me=(e,t)=>Ba.call(e,t),te=Array.isArray,zt=e=>rs(e)==="[object Map]",Dt=e=>rs(e)==="[object Set]",vi=e=>rs(e)==="[object Date]",re=e=>typeof e=="function",Pe=e=>typeof e=="string",St=e=>typeof e=="symbol",_e=e=>e!==null&&typeof e=="object",cl=e=>(_e(e)||re(e))&&re(e.then)&&re(e.catch),dl=Object.prototype.toString,rs=e=>dl.call(e),Va=e=>rs(e).slice(8,-1),fl=e=>rs(e)==="[object Object]",qo=e=>Pe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Wn=Wo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Hs=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Wa=/-\w/g,Ye=Hs(e=>e.replace(Wa,t=>t.slice(1).toUpperCase())),Ka=/\B([A-Z])/g,tn=Hs(e=>e.replace(Ka,"-$1").toLowerCase()),Us=Hs(e=>e.charAt(0).toUpperCase()+e.slice(1)),so=Hs(e=>e?`on${Us(e)}`:""),$t=(e,t)=>!Object.is(e,t),bs=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},pl=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},js=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let mi;const Bs=()=>mi||(mi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ae(e){if(te(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],o=Pe(s)?Ja(s):Ae(s);if(o)for(const l in o)t[l]=o[l]}return t}else if(Pe(e)||_e(e))return e}const qa=/;(?![^(]*\))/g,Ya=/:([^]+)/,za=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function Ja(e){const t={};return e.replace(za,n=>n.startsWith("/*")?"":n).split(qa).forEach(n=>{if(n){const s=n.split(Ya);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function le(e){let t="";if(Pe(e))t=e;else if(te(e))for(let n=0;n<e.length;n++){const s=le(e[n]);s&&(t+=s+" ")}else if(_e(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Ga="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Xa=Wo(Ga);function hl(e){return!!e||e===""}function Za(e,t,n){if(e.length!==t.length)return!1;let s=!0;for(let o=0;s&&o<e.length;o++)s=ft(e[o],t[o],n);return s}function yi(e,t,n){if(e.size!==t.size)return!1;const s=Array.from(t),o=new Uint8Array(s.length);for(const l of e){let a=-1;for(let r=0;r<s.length;r++)if(!o[r]&&ft(l,s[r],n)){a=r;break}if(a<0)return!1;o[a]=1}return!0}function Qa(e,t,n){let s=zt(e),o=zt(t);if(s||o||(s=Dt(e),o=Dt(t),s||o))return s&&o?yi(e,t,n):!1;const l=Object.keys(e).length,a=Object.keys(t).length;if(l!==a)return!1;for(const r in e){const c=e.hasOwnProperty(r),f=t.hasOwnProperty(r);if(c&&!f||!c&&f||!ft(e[r],t[r],n))return!1}return String(e)===String(t)}function gi(e,t,n,s){n||(n=[new Map,new Map]);const[o,l]=n;if(o.has(e)||l.has(t))return o.get(e)===t&&l.get(t)===e;o.set(e,t),l.set(t,e);const a=s(e,t,n);return o.delete(e),l.delete(t),a}function ft(e,t,n){if(e===t)return!0;let s=vi(e),o=vi(t);return s||o?s&&o?e.getTime()===t.getTime():!1:(s=St(e),o=St(t),s||o?e===t:(s=te(e),o=te(t),s||o?s&&o?gi(e,t,n,Za):!1:(s=_e(e),o=_e(t),s||o?!s||!o?!1:gi(e,t,n,Qa):String(e)===String(t))))}function Yo(e,t){return e.findIndex(n=>ft(n,t))}const vl=e=>!!(e&&e.__v_isRef===!0),m=e=>Pe(e)?e:e==null?"":te(e)||_e(e)&&(e.toString===dl||!re(e.toString))?vl(e)?m(e.value):JSON.stringify(e,ml,2):String(e),ml=(e,t)=>vl(t)?ml(e,t.value):zt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,o],l)=>(n[oo(s,l)+" =>"]=o,n),{})}:Dt(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>oo(n))}:St(t)?oo(t):_e(t)&&!te(t)&&!fl(t)?String(t):t,oo=(e,t="")=>{var n;return St(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let Re;class er{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&Re&&(Re.active?(this.parent=Re,this.index=(Re.scopes||(Re.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const s=this.scopes.slice();for(t=0,n=s.length;t<n;t++)s[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const s=this.effects.slice();for(t=0,n=s.length;t<n;t++)s[t].resume()}}run(t){if(this._active){const n=Re;try{return Re=this,t()}finally{Re=n}}}on(){++this._on===1&&(this.prevScope=Re,Re=this)}off(){if(this._on>0&&--this._on===0){if(Re===this)Re=this.prevScope;else{let t=Re;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,s;for(n=0,s=this.effects.length;n<s;n++)this.effects[n].stop();for(this.effects.length=0,n=0,s=this.cleanups.length;n<s;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(n=0,s=o.length;n<s;n++)o[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function tr(){return Re}let Ce;const io=new WeakSet;class yl{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Re&&(Re.active?Re.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,io.has(this)&&(io.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||bl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,bi(this),wl(this);const t=Ce,n=dt;Ce=this,dt=!0;try{return this.fn()}finally{_l(this),Ce=t,dt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Go(t);this.deps=this.depsTail=void 0,bi(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?io.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){$o(this)&&this.run()}get dirty(){return $o(this)}}let gl=0,Kn,qn;function bl(e,t=!1){if(e.flags|=8,t){e.next=qn,qn=e;return}e.next=Kn,Kn=e}function zo(){gl++}function Jo(){if(--gl>0)return;if(qn){let t=qn;for(qn=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Kn;){let t=Kn;for(Kn=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function wl(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function _l(e){let t,n=e.depsTail,s=n;for(;s;){const o=s.prevDep;s.version===-1?(s===n&&(n=o),Go(s),nr(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=o}e.deps=t,e.depsTail=n}function $o(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(kl(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function kl(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Xn)||(e.globalVersion=Xn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!$o(e))))return;e.flags|=2;const t=e.dep,n=Ce,s=dt;Ce=e,dt=!0;try{wl(e);const o=e.fn(e._value);(t.version===0||$t(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Ce=n,dt=s,_l(e),e.flags&=-3}}function Go(e,t=!1){const{dep:n,prevSub:s,nextSub:o}=e;if(s&&(s.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let l=n.computed.deps;l;l=l.nextDep)Go(l,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function nr(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let dt=!0;const $l=[];function Ft(){$l.push(dt),dt=!1}function Nt(){const e=$l.pop();dt=e===void 0?!0:e}function bi(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ce;Ce=void 0;try{t()}finally{Ce=n}}}let Xn=0;class sr{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Xo{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Ce||!dt||Ce===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ce)n=this.activeLink=new sr(Ce,this),Ce.deps?(n.prevDep=Ce.depsTail,Ce.depsTail.nextDep=n,Ce.depsTail=n):Ce.deps=Ce.depsTail=n,xl(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=Ce.depsTail,n.nextDep=void 0,Ce.depsTail.nextDep=n,Ce.depsTail=n,Ce.deps===n&&(Ce.deps=s)}return n}trigger(t){this.version++,Xn++,this.notify(t)}notify(t){zo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Jo()}}}function xl(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)xl(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const xo=new WeakMap,cn=Symbol(""),So=Symbol(""),Zn=Symbol("");function Ue(e,t,n){if(dt&&Ce){let s=xo.get(e);s||xo.set(e,s=new Map);let o=s.get(n);o||(s.set(n,o=new Xo),o.map=s,o.key=n),o.track()}}function It(e,t,n,s,o,l){const a=xo.get(e);if(!a){Xn++;return}const r=c=>{c&&c.trigger()};if(zo(),t==="clear")a.forEach(r);else{const c=te(e),f=c&&qo(n);if(c&&n==="length"){const u=Number(s);a.forEach((h,w)=>{(w==="length"||w===Zn||!St(w)&&w>=u)&&r(h)})}else switch((n!==void 0||a.has(void 0))&&r(a.get(n)),f&&r(a.get(Zn)),t){case"add":c?f&&r(a.get("length")):(r(a.get(cn)),zt(e)&&r(a.get(So)));break;case"delete":c||(r(a.get(cn)),zt(e)&&r(a.get(So)));break;case"set":zt(e)&&r(a.get(cn));break}}Jo()}function _n(e){const t=ve(e);return t===e||(Ue(t,"iterate",Zn),at(e))?t:Ct(e)?Jt(e)?t.map(n=>Gt(rt(n))):t.map(Gt):t.map(rt)}function Vs(e){return Ue(e=ve(e),"iterate",Zn),e}function _t(e,t){return Ct(e)?Gt(Jt(e)?rt(t):t):rt(t)}const or={__proto__:null,[Symbol.iterator](){return lo(this,Symbol.iterator,e=>_t(this,e))},concat(...e){return _n(this).concat(...e.map(t=>te(t)?_n(t):t))},entries(){return lo(this,"entries",e=>(e[1]=_t(this,e[1]),e))},every(e,t){return At(this,"every",e,t,void 0,arguments)},filter(e,t){return At(this,"filter",e,t,n=>n.map(s=>_t(this,s)),arguments)},find(e,t){return At(this,"find",e,t,n=>_t(this,n),arguments)},findIndex(e,t){return At(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return At(this,"findLast",e,t,n=>_t(this,n),arguments)},findLastIndex(e,t){return At(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return At(this,"forEach",e,t,void 0,arguments)},includes(...e){return ao(this,"includes",e)},indexOf(...e){return ao(this,"indexOf",e)},join(e){return _n(this).join(e)},lastIndexOf(...e){return ao(this,"lastIndexOf",e)},map(e,t){return At(this,"map",e,t,void 0,arguments)},pop(){return Ln(this,"pop")},push(...e){return Ln(this,"push",e)},reduce(e,...t){return wi(this,"reduce",e,t)},reduceRight(e,...t){return wi(this,"reduceRight",e,t)},shift(){return Ln(this,"shift")},some(e,t){return At(this,"some",e,t,void 0,arguments)},splice(...e){return Ln(this,"splice",e)},toReversed(){return _n(this).toReversed()},toSorted(e){return _n(this).toSorted(e)},toSpliced(...e){return _n(this).toSpliced(...e)},unshift(...e){return Ln(this,"unshift",e)},values(){return lo(this,"values",e=>_t(this,e))}};function lo(e,t,n){const s=Vs(e),o=s[t]();return s!==e&&!at(e)&&(o._next=o.next,o.next=()=>{const l=o._next();return l.done||(l.value=n(l.value)),l}),o}const ir=Array.prototype;function At(e,t,n,s,o,l){const a=Vs(e),r=a!==e&&!at(e),c=a[t];if(c!==ir[t]){const h=c.apply(e,l);return r?rt(h):h}let f=n;a!==e&&(r?f=function(h,w){return n.call(this,_t(e,h),w,e)}:n.length>2&&(f=function(h,w){return n.call(this,h,w,e)}));const u=c.call(a,f,s);return r&&o?o(u):u}function wi(e,t,n,s){const o=Vs(e),l=o!==e&&!at(e);let a=n,r=!1;o!==e&&(l?(r=s.length===0,a=function(f,u,h){return r&&(r=!1,f=_t(e,f)),n.call(this,f,_t(e,u),h,e)}):n.length>3&&(a=function(f,u,h){return n.call(this,f,u,h,e)}));const c=o[t](a,...s);return r?_t(e,c):c}function ao(e,t,n){const s=ve(e);Ue(s,"iterate",Zn);const o=s[t](...n);return(o===-1||o===!1)&&ei(n[0])?(n[0]=ve(n[0]),s[t](...n)):o}function Ln(e,t,n=[]){Ft(),zo();const s=ve(e)[t].apply(e,n);return Jo(),Nt(),s}const lr=Wo("__proto__,__v_isRef,__isVue"),Sl=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(St));function ar(e){St(e)||(e=String(e));const t=ve(this);return Ue(t,"has",e),t.hasOwnProperty(e)}class Cl{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,l=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return l;if(n==="__v_raw")return s===(o?l?yr:Pl:l?El:Al).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const a=te(t);if(!o){let c;if(a&&(c=or[n]))return c;if(n==="hasOwnProperty")return ar}const r=Reflect.get(t,n,Ve(t)?t:s);if((St(n)?Sl.has(n):lr(n))||(o||Ue(t,"get",n),l))return r;if(Ve(r)){const c=a&&qo(n)?r:r.value;return o&&_e(c)?To(c):c}return _e(r)?o?To(r):yn(r):r}}class Tl extends Cl{constructor(t=!1){super(!1,t)}set(t,n,s,o){let l=t[n];const a=te(t)&&qo(n);if(!this._isShallow){const f=Ct(l);if(!at(s)&&!Ct(s)&&(l=ve(l),s=ve(s)),!a&&Ve(l)&&!Ve(s))return f||(l.value=s),!0}const r=a?Number(n)<t.length:me(t,n),c=Reflect.set(t,n,s,Ve(t)?t:o);return t===ve(o)&&c&&(r?$t(s,l)&&It(t,"set",n,s):It(t,"add",n,s)),c}deleteProperty(t,n){const s=me(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&s&&It(t,"delete",n,void 0),o}has(t,n){const s=Reflect.has(t,n);return(!St(n)||!Sl.has(n))&&Ue(t,"has",n),s}ownKeys(t){return Ue(t,"iterate",te(t)?"length":cn),Reflect.ownKeys(t)}}class rr extends Cl{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const ur=new Tl,cr=new rr,dr=new Tl(!0);const Co=e=>e,hs=e=>Reflect.getPrototypeOf(e);function fr(e,t,n){return function(...s){const o=this.__v_raw,l=ve(o),a=zt(l),r=e==="entries"||e===Symbol.iterator&&a,c=e==="keys"&&a,f=o[e](...s),u=n?Co:t?Gt:rt;return!t&&Ue(l,"iterate",c?So:cn),He(Object.create(f),{next(){const{value:h,done:w}=f.next();return w?{value:h,done:w}:{value:r?[u(h[0]),u(h[1])]:u(h),done:w}}})}}function vs(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function pr(e,t){const n={get(o){const l=this.__v_raw,a=ve(l),r=ve(o);e||($t(o,r)&&Ue(a,"get",o),Ue(a,"get",r));const{has:c}=hs(a),f=t?Co:e?Gt:rt;if(c.call(a,o))return f(l.get(o));if(c.call(a,r))return f(l.get(r));l!==a&&l.get(o)},get size(){const o=this.__v_raw;return!e&&Ue(ve(o),"iterate",cn),o.size},has(o){const l=this.__v_raw,a=ve(l),r=ve(o);return e||($t(o,r)&&Ue(a,"has",o),Ue(a,"has",r)),o===r?l.has(o):l.has(o)||l.has(r)},forEach(o,l){const a=this,r=a.__v_raw,c=ve(r),f=t?Co:e?Gt:rt;return!e&&Ue(c,"iterate",cn),r.forEach((u,h)=>o.call(l,f(u),f(h),a))}};return He(n,e?{add:vs("add"),set:vs("set"),delete:vs("delete"),clear:vs("clear")}:{add(o){const l=ve(this),a=hs(l),r=ve(o),c=!t&&!at(o)&&!Ct(o)?r:o;return a.has.call(l,c)||$t(o,c)&&a.has.call(l,o)||$t(r,c)&&a.has.call(l,r)||(l.add(c),It(l,"add",c,c)),this},set(o,l){!t&&!at(l)&&!Ct(l)&&(l=ve(l));const a=ve(this),{has:r,get:c}=hs(a);let f=r.call(a,o);f||(o=ve(o),f=r.call(a,o));const u=c.call(a,o);return a.set(o,l),f?$t(l,u)&&It(a,"set",o,l):It(a,"add",o,l),this},delete(o){const l=ve(this),{has:a,get:r}=hs(l);let c=a.call(l,o);c||(o=ve(o),c=a.call(l,o)),r&&r.call(l,o);const f=l.delete(o);return c&&It(l,"delete",o,void 0),f},clear(){const o=ve(this),l=o.size!==0,a=o.clear();return l&&It(o,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=fr(o,e,t)}),n}function Zo(e,t){const n=pr(e,t);return(s,o,l)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?s:Reflect.get(me(n,o)&&o in s?n:s,o,l)}const hr={get:Zo(!1,!1)},vr={get:Zo(!1,!0)},mr={get:Zo(!0,!1)};const Al=new WeakMap,El=new WeakMap,Pl=new WeakMap,yr=new WeakMap;function gr(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function yn(e){return Ct(e)?e:Qo(e,!1,ur,hr,Al)}function br(e){return Qo(e,!1,dr,vr,El)}function To(e){return Qo(e,!0,cr,mr,Pl)}function Qo(e,t,n,s,o){if(!_e(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const l=o.get(e);if(l)return l;const a=gr(Va(e));if(a===0)return e;const r=new Proxy(e,a===2?s:n);return o.set(e,r),r}function Jt(e){return Ct(e)?Jt(e.__v_raw):!!(e&&e.__v_isReactive)}function Ct(e){return!!(e&&e.__v_isReadonly)}function at(e){return!!(e&&e.__v_isShallow)}function ei(e){return e?!!e.__v_raw:!1}function ve(e){const t=e&&e.__v_raw;return t?ve(t):e}function wr(e){return!me(e,"__v_skip")&&Object.isExtensible(e)&&pl(e,"__v_skip",!0),e}const rt=e=>_e(e)?yn(e):e,Gt=e=>_e(e)?To(e):e;function Ve(e){return e?e.__v_isRef===!0:!1}function de(e){return _r(e,!1)}function _r(e,t){return Ve(e)?e:new kr(e,t)}class kr{constructor(t,n){this.dep=new Xo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ve(t),this._value=n?t:rt(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||at(t)||Ct(t);t=s?t:ve(t),$t(t,n)&&(this._rawValue=t,this._value=s?t:rt(t),this.dep.trigger())}}function y(e){return Ve(e)?e.value:e}const $r={get:(e,t,n)=>t==="__v_raw"?e:y(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const o=e[t];return Ve(o)&&!Ve(n)?(o.value=n,!0):Reflect.set(e,t,n,s)}};function Ol(e){return Jt(e)?e:new Proxy(e,$r)}class xr{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Xo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Xn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&Ce!==this)return bl(this,!0),!0}get value(){const t=this.dep.track();return kl(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Sr(e,t,n=!1){let s,o;return re(e)?s=e:(s=e.get,o=e.set),new xr(s,o,n)}const ms={},Ss=new WeakMap;let an;function Cr(e,t=!1,n=an){if(n){let s=Ss.get(n);s||Ss.set(n,s=[]),s.push(e)}}function Tr(e,t,n=xe){const{immediate:s,deep:o,once:l,scheduler:a,augmentJob:r,call:c}=n,f=C=>o?C:at(C)||o===!1||o===0?Mt(C,1):Mt(C);let u,h,w,$,D=!1,E=!1;if(Ve(e)?(h=()=>e.value,D=at(e)):Jt(e)?(h=()=>f(e),D=!0):te(e)?(E=!0,D=e.some(C=>Jt(C)||at(C)),h=()=>e.map(C=>{if(Ve(C))return C.value;if(Jt(C))return f(C);if(re(C))return c?c(C,2):C()})):re(e)?t?h=c?()=>c(e,2):e:h=()=>{if(w){Ft();try{w()}finally{Nt()}}const C=an;an=u;try{return c?c(e,3,[$]):e($)}finally{an=C}}:h=xt,t&&o){const C=h,V=o===!0?1/0:o;h=()=>Mt(C(),V)}const x=tr(),S=()=>{u.stop(),x&&x.active&&Ko(x.effects,u)};if(l&&t){const C=t;t=(...V)=>{const I=C(...V);return S(),I}}let L=E?new Array(e.length).fill(ms):ms;const J=C=>{if(!(!(u.flags&1)||!u.dirty&&!C))if(t){const V=u.run();if(C||o||D||(E?V.some((I,A)=>$t(I,L[A])):$t(V,L))){w&&w();const I=an;an=u;try{const A=[V,L===ms?void 0:E&&L[0]===ms?[]:L,$];L=V,c?c(t,3,A):t(...A)}finally{an=I}}}else u.run()};return r&&r(J),u=new yl(h),u.scheduler=a?()=>a(J,!1):J,$=C=>Cr(C,!1,u),w=u.onStop=()=>{const C=Ss.get(u);if(C){if(c)c(C,4);else for(const V of C)V();Ss.delete(u)}},t?s?J(!0):L=u.run():a?a(J.bind(null,!0),!0):u.run(),S.pause=u.pause.bind(u),S.resume=u.resume.bind(u),S.stop=S,S}function Mt(e,t=1/0,n){if(t<=0||!_e(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Ve(e))Mt(e.value,t,n);else if(te(e))for(let s=0;s<e.length;s++)Mt(e[s],t,n);else if(Dt(e)||zt(e))e.forEach(s=>{Mt(s,t,n)});else if(fl(e)){for(const s in e)Mt(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&Mt(e[s],t,n)}return e}function us(e,t,n,s){try{return s?e(...s):e()}catch(o){Ws(o,t,n)}}function pt(e,t,n,s){if(re(e)){const o=us(e,t,n,s);return o&&cl(o)&&o.catch(l=>{Ws(l,t,n)}),o}if(te(e)){const o=[];for(let l=0;l<e.length;l++)o.push(pt(e[l],t,n,s));return o}}function Ws(e,t,n,s=!0){const o=t?t.vnode:null,{errorHandler:l,throwUnhandledErrorInProduction:a}=t&&t.appContext.config||xe;if(t){let r=t.parent;const c=t.proxy,f=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const u=r.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](e,c,f)===!1)return}r=r.parent}if(l){Ft(),us(l,null,10,[e,c,f]),Nt();return}}Ar(e,n,o,s,a)}function Ar(e,t,n,s=!0,o=!1){if(o)throw e;console.error(e)}const qe=[];let bt=-1;const xn=[];let Wt=null,kn=0;const Il=Promise.resolve();let Cs=null;function Ks(e){const t=Cs||Il;return e?t.then(this?e.bind(this):e):t}function Er(e){let t=bt+1,n=qe.length;for(;t<n;){const s=t+n>>>1,o=qe[s],l=Qn(o);l<e||l===e&&o.flags&2?t=s+1:n=s}return t}function ti(e){if(!(e.flags&1)){const t=Qn(e),n=qe[qe.length-1];!n||!(e.flags&2)&&t>=Qn(n)?qe.push(e):qe.splice(Er(t),0,e),e.flags|=1,Ml()}}function Ml(){Cs||(Cs=Il.then(Dl))}function Pr(e){if(!te(e))Wt&&e.id===-1?Wt.splice(kn+1,0,e):e.flags&1||(xn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)xn.push(e[t]);Ml()}function _i(e,t,n=bt+1){for(;n<qe.length;n++){const s=qe[n];if(s&&s.flags&2){if(e&&s.id!==e.uid)continue;qe.splice(n,1),n--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function Ll(e){if(xn.length){const t=[...new Set(xn)].sort((n,s)=>Qn(n)-Qn(s));if(xn.length=0,Wt){for(let n=0;n<t.length;n++)Wt.push(t[n]);return}for(Wt=t,kn=0;kn<Wt.length;kn++){const n=Wt[kn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Wt=null,kn=0}}const Qn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Dl(e){try{for(bt=0;bt<qe.length;bt++){const t=qe[bt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),us(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;bt<qe.length;bt++){const t=qe[bt];t&&(t.flags&=-2)}bt=-1,qe.length=0,Ll(),Cs=null,(qe.length||xn.length)&&Dl()}}let Qe=null,Fl=null;function Ts(e){const t=Qe;return Qe=e,Fl=e&&e.type.__scopeId||null,t}function Or(e,t=Qe,n){if(!t||e._n)return e;const s=(...o)=>{s._d&&Mi(-1);const l=Ts(t),a=fn.length;let r;try{r=e(...o)}finally{for(let c=fn.length;c>a;c--)aa();Ts(l),s._d&&Mi(1)}return r};return s._n=!0,s._c=!0,s._d=!0,s}function ye(e,t){if(Qe===null)return e;const n=Gs(Qe),s=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[l,a,r,c=xe]=t[o];l&&(re(l)&&(l={mounted:l,updated:l}),l.deep&&Mt(a),s.push({dir:l,instance:n,value:a,oldValue:void 0,arg:r,modifiers:c}))}return e}function on(e,t,n,s){const o=e.dirs,l=t&&t.dirs;for(let a=0;a<o.length;a++){const r=o[a];l&&(r.oldValue=l[a].value);let c=r.dir[s];c&&(Ft(),pt(c,n,8,[e.el,r,e,t]),Nt())}}function Ir(e,t){if(je){let n=je.provides;const s=je.parent&&je.parent.provides;s===n&&(n=je.provides=Object.create(s)),n[e]=t}}function ws(e,t,n=!1){const s=Eu();if(s||Sn){let o=Sn?Sn._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&re(t)?t.call(s&&s.proxy):t}}const Mr=Symbol.for("v-scx"),Lr=()=>ws(Mr);function dn(e,t,n){return Nl(e,t,n)}function Nl(e,t,n=xe){const{immediate:s,deep:o,flush:l,once:a}=n,r=He({},n),c=t&&s||!t&&l!=="post";let f;if(ns){if(l==="sync"){const $=Lr();f=$.__watcherHandles||($.__watcherHandles=[])}else if(!c){const $=()=>{};return $.stop=xt,$.resume=xt,$.pause=xt,$}}const u=je;r.call=($,D,E)=>pt($,u,D,E);let h=!1;l==="post"?r.scheduler=$=>{ze($,u&&u.suspense)}:l!=="sync"&&(h=!0,r.scheduler=($,D)=>{D?$():ti($)}),r.augmentJob=$=>{t&&($.flags|=4),h&&($.flags|=2,u&&($.id=u.uid,$.i=u))};const w=Tr(e,t,r);return ns&&(f?f.push(w):c&&w()),w}function Dr(e,t,n){const s=this.proxy,o=Pe(e)?e.includes(".")?Rl(s,e):()=>s[e]:e.bind(s,s);let l;re(t)?l=t:(l=t.handler,n=t);const a=cs(this),r=Nl(o,l.bind(s),n);return a(),r}function Rl(e,t){const n=t.split(".");return()=>{let s=e;for(let o=0;o<n.length&&s;o++)s=s[n[o]];return s}}const Fr=Symbol("_vte"),qs=e=>e.__isTeleport,ro=Symbol("_leaveCb");function Nr(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Rt){t=n;break}}return t}function Hl(e){if(!si(e))return qs(e.type)&&e.children?Nr(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&re(n.default))return n.default()}}function ni(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;const n=e.component.subTree;ni(qs(n.type)&&Hl(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Te(e,t){return re(e)?He({name:e.name},t,{setup:e}):e}function Ul(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function ki(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const As=new WeakMap;function Yn(e,t,n,s,o=!1){if(te(e)){e.forEach((E,x)=>Yn(E,t&&(te(t)?t[x]:t),n,s,o));return}if(zn(s)&&!o){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Yn(e,t,n,s.component.subTree);return}const l=s.shapeFlag&4?Gs(s.component):s.el,a=o?null:l,{i:r,r:c}=e,f=t&&t.r,u=r.refs===xe?r.refs={}:r.refs,h=r.setupState,w=ve(h),$=h===xe?ul:E=>ki(u,E)?!1:me(w,E),D=(E,x)=>!(x&&ki(u,x));if(f!=null&&f!==c){if($i(t),Pe(f))u[f]=null,$(f)&&(h[f]=null);else if(Ve(f)){const E=t;D(f,E.k)&&(f.value=null),E.k&&(u[E.k]=null)}}if(re(c))us(c,r,12,[a,u]);else{const E=Pe(c),x=Ve(c);if(E||x){const S=()=>{if(e.f){const L=E?$(c)?h[c]:u[c]:D()||!e.k?c.value:u[e.k];if(o)te(L)&&Ko(L,l);else if(te(L))L.includes(l)||L.push(l);else if(E)u[c]=[l],$(c)&&(h[c]=u[c]);else{const J=[l];D(c,e.k)&&(c.value=J),e.k&&(u[e.k]=J)}}else E?(u[c]=a,$(c)&&(h[c]=a)):x&&(D(c,e.k)&&(c.value=a),e.k&&(u[e.k]=a))};if(a){const L=()=>{S(),As.delete(e)};L.id=-1,As.set(e,L),ze(L,n)}else $i(e),S()}}}function $i(e){const t=As.get(e);t&&(t.flags|=8,As.delete(e))}Bs().requestIdleCallback;Bs().cancelIdleCallback;const zn=e=>!!e.type.__asyncLoader,si=e=>e.type.__isKeepAlive;function Rr(e,t){jl(e,"a",t)}function Hr(e,t){jl(e,"da",t)}function jl(e,t,n=je){const s=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Ys(t,s,n),n){let o=n.parent;for(;o&&o.parent;)si(o.parent.vnode)&&Ur(s,t,n,o),o=o.parent}}function Ur(e,t,n,s){const o=Ys(t,e,s,!0);Bl(()=>{Ko(s[t],o)},n)}function Ys(e,t,n=je,s=!1){if(n){const o=n[e]||(n[e]=[]),l=t.__weh||(t.__weh=(...a)=>{Ft();const r=cs(n),c=pt(t,n,e,a);return r(),Nt(),c});return s?o.unshift(l):o.push(l),l}}const Ut=e=>(t,n=je)=>{(!ns||e==="sp")&&Ys(e,(...s)=>t(...s),n)},jr=Ut("bm"),wn=Ut("m"),Br=Ut("bu"),Vr=Ut("u"),On=Ut("bum"),Bl=Ut("um"),Wr=Ut("sp"),Kr=Ut("rtg"),qr=Ut("rtc");function Yr(e,t=je){Ys("ec",e,t)}const zr="components",Vl=Symbol.for("v-ndc");function Jr(e){return Pe(e)?Gr(zr,e,!1)||e:e||Vl}function Gr(e,t,n=!0,s=!1){const o=Qe||je;if(o){const l=o.type;{const r=Lu(l,!1);if(r&&(r===t||r===Ye(t)||r===Us(Ye(t))))return l}const a=xi(o[e]||l[e],t)||xi(o.appContext[e],t);return!a&&s?l:a}}function xi(e,t){return e&&(e[t]||e[Ye(t)]||e[Us(Ye(t))])}function ie(e,t,n,s){let o;const l=n,a=te(e);if(a||Pe(e)){const r=a&&Jt(e);let c=!1,f=!1;r&&(c=!at(e),f=Ct(e),e=Vs(e)),o=new Array(e.length);for(let u=0,h=e.length;u<h;u++)o[u]=t(c?f?Gt(rt(e[u])):rt(e[u]):e[u],u,void 0,l)}else if(typeof e=="number"){o=new Array(e);for(let r=0;r<e;r++)o[r]=t(r+1,r,void 0,l)}else if(_e(e))if(e[Symbol.iterator])o=Array.from(e,(r,c)=>t(r,c,void 0,l));else{const r=Object.keys(e);o=new Array(r.length);for(let c=0,f=r.length;c<f;c++){const u=r[c];o[c]=t(e[u],u,c,l)}}else o=[];return o}const Ao=e=>e?da(e)?Gs(e):Ao(e.parent):null,Jn=He(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ao(e.parent),$root:e=>Ao(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Kl(e),$forceUpdate:e=>e.f||(e.f=()=>{ti(e.update)}),$nextTick:e=>e.n||(e.n=Ks.bind(e.proxy)),$watch:e=>Dr.bind(e)}),uo=(e,t)=>e!==xe&&!e.__isScriptSetup&&me(e,t),Xr={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:o,props:l,accessCache:a,type:r,appContext:c}=e;if(t[0]!=="$"){const w=a[t];if(w!==void 0)switch(w){case 1:return s[t];case 2:return o[t];case 4:return n[t];case 3:return l[t]}else{if(uo(s,t))return a[t]=1,s[t];if(o!==xe&&me(o,t))return a[t]=2,o[t];if(me(l,t))return a[t]=3,l[t];if(n!==xe&&me(n,t))return a[t]=4,n[t];Eo&&(a[t]=0)}}const f=Jn[t];let u,h;if(f)return t==="$attrs"&&Ue(e.attrs,"get",""),f(e);if((u=r.__cssModules)&&(u=u[t]))return u;if(n!==xe&&me(n,t))return a[t]=4,n[t];if(h=c.config.globalProperties,me(h,t))return h[t]},set({_:e},t,n){const{data:s,setupState:o,ctx:l}=e;return uo(o,t)?(o[t]=n,!0):s!==xe&&me(s,t)?(s[t]=n,!0):me(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(l[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:o,props:l,type:a}},r){let c;return!!(n[r]||e!==xe&&r[0]!=="$"&&me(e,r)||uo(t,r)||me(l,r)||me(s,r)||me(Jn,r)||me(o.config.globalProperties,r)||(c=a.__cssModules)&&c[r])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:me(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Si(e){return te(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Eo=!0;function Zr(e){const t=Kl(e),n=e.proxy,s=e.ctx;Eo=!1,t.beforeCreate&&Ci(t.beforeCreate,e,"bc");const{data:o,computed:l,methods:a,watch:r,provide:c,inject:f,created:u,beforeMount:h,mounted:w,beforeUpdate:$,updated:D,activated:E,deactivated:x,beforeDestroy:S,beforeUnmount:L,destroyed:J,unmounted:C,render:V,renderTracked:I,renderTriggered:A,errorCaptured:b,serverPrefetch:T,expose:ne,inheritAttrs:Se,components:Oe,directives:G,filters:M}=t;if(f&&Qr(f,s,null),a)for(const oe in a){const fe=a[oe];re(fe)&&(s[oe]=fe.bind(n))}if(o){const oe=o.call(n,n);_e(oe)&&(e.data=yn(oe))}if(Eo=!0,l)for(const oe in l){const fe=l[oe],Z=re(fe)?fe.bind(n,n):re(fe.get)?fe.get.bind(n,n):xt,ue=!re(fe)&&re(fe.set)?fe.set.bind(n):xt,Me=k({get:Z,set:ue});Object.defineProperty(s,oe,{enumerable:!0,configurable:!0,get:()=>Me.value,set:Fe=>Me.value=Fe})}if(r)for(const oe in r)Wl(r[oe],s,n,oe);if(c){const oe=re(c)?c.call(n):c;Reflect.ownKeys(oe).forEach(fe=>{Ir(fe,oe[fe])})}u&&Ci(u,e,"c");function z(oe,fe){te(fe)?fe.forEach(Z=>oe(Z.bind(n))):fe&&oe(fe.bind(n))}if(z(jr,h),z(wn,w),z(Br,$),z(Vr,D),z(Rr,E),z(Hr,x),z(Yr,b),z(qr,I),z(Kr,A),z(On,L),z(Bl,C),z(Wr,T),te(ne))if(ne.length){const oe=e.exposed||(e.exposed={});ne.forEach(fe=>{Object.defineProperty(oe,fe,{get:()=>n[fe],set:Z=>n[fe]=Z,enumerable:!0})})}else e.exposed||(e.exposed={});V&&e.render===xt&&(e.render=V),Se!=null&&(e.inheritAttrs=Se),Oe&&(e.components=Oe),G&&(e.directives=G),T&&Ul(e)}function Qr(e,t,n=xt){te(e)&&(e=Po(e));for(const s in e){const o=e[s];let l;_e(o)?"default"in o?l=ws(o.from||s,o.default,!0):l=ws(o.from||s):l=ws(o),Ve(l)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>l.value,set:a=>l.value=a}):t[s]=l}}function Ci(e,t,n){pt(te(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Wl(e,t,n,s){let o=s.includes(".")?Rl(n,s):()=>n[s];if(Pe(e)){const l=t[e];re(l)&&dn(o,l)}else if(re(e))dn(o,e.bind(n));else if(_e(e))if(te(e))e.forEach(l=>Wl(l,t,n,s));else{const l=re(e.handler)?e.handler.bind(n):t[e.handler];re(l)&&dn(o,l,e)}}function Kl(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:o,optionsCache:l,config:{optionMergeStrategies:a}}=e.appContext,r=l.get(t);let c;return r?c=r:!o.length&&!n&&!s?c=t:(c={},o.length&&o.forEach(f=>Es(c,f,a,!0)),Es(c,t,a)),_e(t)&&l.set(t,c),c}function Es(e,t,n,s=!1){const{mixins:o,extends:l}=t;l&&Es(e,l,n,!0),o&&o.forEach(a=>Es(e,a,n,!0));for(const a in t)if(!(s&&a==="expose")){const r=eu[a]||n&&n[a];e[a]=r?r(e[a],t[a]):t[a]}return e}const eu={data:Ti,props:Ai,emits:Ai,methods:Rn,computed:Rn,beforeCreate:We,created:We,beforeMount:We,mounted:We,beforeUpdate:We,updated:We,beforeDestroy:We,beforeUnmount:We,destroyed:We,unmounted:We,activated:We,deactivated:We,errorCaptured:We,serverPrefetch:We,components:Rn,directives:Rn,watch:nu,provide:Ti,inject:tu};function Ti(e,t){return t?e?function(){return He(re(e)?e.call(this,this):e,re(t)?t.call(this,this):t)}:t:e}function tu(e,t){return Rn(Po(e),Po(t))}function Po(e){if(te(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function We(e,t){return e?[...new Set([].concat(e,t))]:t}function Rn(e,t){return e?He(Object.create(null),e,t):t}function Ai(e,t){return e?te(e)&&te(t)?[...new Set([...e,...t])]:He(Object.create(null),Si(e),Si(t??{})):t}function nu(e,t){if(!e)return t;if(!t)return e;const n=He(Object.create(null),e);for(const s in t)n[s]=We(e[s],t[s]);return n}function ql(){return{app:null,config:{isNativeTag:ul,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let su=0;function ou(e,t){return function(s,o=null){re(s)||(s=He({},s)),o!=null&&!_e(o)&&(o=null);const l=ql(),a=new WeakSet,r=[];let c=!1;const f=l.app={_uid:su++,_component:s,_props:o,_container:null,_context:l,_instance:null,version:Fu,get config(){return l.config},set config(u){},use(u,...h){return a.has(u)||(u&&re(u.install)?(a.add(u),u.install(f,...h)):re(u)&&(a.add(u),u(f,...h))),f},mixin(u){return l.mixins.includes(u)||l.mixins.push(u),f},component(u,h){return h?(l.components[u]=h,f):l.components[u]},directive(u,h){return h?(l.directives[u]=h,f):l.directives[u]},mount(u,h,w){if(!c){const $=f._ceVNode||we(s,o);return $.appContext=l,w===!0?w="svg":w===!1&&(w=void 0),e($,u,w),c=!0,f._container=u,u.__vue_app__=f,Gs($.component)}},onUnmount(u){r.push(u)},unmount(){c&&(pt(r,f._instance,16),e(null,f._container),delete f._container.__vue_app__)},provide(u,h){return l.provides[u]=h,f},runWithContext(u){const h=Sn;Sn=f;try{return u()}finally{Sn=h}}};return f}}let Sn=null;const iu=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Ye(t)}Modifiers`]||e[`${tn(t)}Modifiers`];function lu(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||xe;let o=n;const l=t.startsWith("update:"),a=l&&iu(s,t.slice(7));a&&(a.trim&&(o=n.map(u=>Pe(u)?u.trim():u)),a.number&&(o=o.map(js)));let r,c=s[r=so(t)]||s[r=so(Ye(t))];!c&&l&&(c=s[r=so(tn(t))]),c&&pt(c,e,6,o);const f=s[r+"Once"];if(f){if(!e.emitted)e.emitted={};else if(e.emitted[r])return;e.emitted[r]=!0,pt(f,e,6,o)}}const au=new WeakMap;function Yl(e,t,n=!1){const s=n?au:t.emitsCache,o=s.get(e);if(o!==void 0)return o;const l=e.emits;let a={},r=!1;if(!re(e)){const c=f=>{const u=Yl(f,t,!0);u&&(r=!0,He(a,u))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!l&&!r?(_e(e)&&s.set(e,null),null):(te(l)?l.forEach(c=>a[c]=null):He(a,l),_e(e)&&s.set(e,a),a)}function zs(e,t){return!e||!Ns(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),me(e,t[0].toLowerCase()+t.slice(1))||me(e,tn(t))||me(e,t))}function Ei(e){const{type:t,vnode:n,proxy:s,withProxy:o,propsOptions:[l],slots:a,attrs:r,emit:c,render:f,renderCache:u,props:h,data:w,setupState:$,ctx:D,inheritAttrs:E}=e,x=Ts(e);let S,L;try{if(n.shapeFlag&4){const C=o||s,V=C;S=kt(f.call(V,C,u,h,$,w,D)),L=r}else{const C=t;S=kt(C.length>1?C(h,{attrs:r,slots:a,emit:c}):C(h,null)),L=t.props?r:ru(r)}}catch(C){fn.length=0,Ws(C,e,1),S=we(Rt)}let J=S;if(L&&E!==!1){const C=Object.keys(L),{shapeFlag:V}=J;C.length&&V&7&&(l&&C.some(Rs)&&(L=uu(L,l)),J=Tn(J,L,!1,!0))}if(n.dirs&&(J=Tn(J,null,!1,!0),J.dirs=J.dirs?J.dirs.concat(n.dirs):n.dirs),n.transition){const C=qs(J.type)&&Hl(J)||J;ni(C,n.transition)}return S=J,Ts(x),S}const ru=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ns(n))&&((t||(t={}))[n]=e[n]);return t},uu=(e,t)=>{const n={};for(const s in e)(!Rs(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function cu(e,t,n){const{props:s,children:o,component:l}=e,{props:a,children:r,patchFlag:c}=t,f=l.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return s?Pi(s,a,f):!!a;if(c&8){const u=t.dynamicProps;for(let h=0;h<u.length;h++){const w=u[h];if(zl(a,s,w)&&!zs(f,w))return!0}}}else return(o||r)&&(!r||!r.$stable)?!0:s===a?!1:s?a?Pi(s,a,f):!0:!!a;return!1}function Pi(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let o=0;o<s.length;o++){const l=s[o];if(zl(t,e,l)&&!zs(n,l))return!0}return!1}function zl(e,t,n){const s=e[n],o=t[n];return n==="style"&&_e(s)&&_e(o)?!ft(s,o):s!==o}function du({vnode:e,parent:t,suspense:n},s){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=s,e=o),o===e)(e=t.vnode).el=s,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=s)}const Jl={},Gl=()=>Object.create(Jl),Xl=e=>Object.getPrototypeOf(e)===Jl;function fu(e,t,n,s=!1){const o={},l=Gl();e.propsDefaults=Object.create(null),Zl(e,t,o,l);for(const a in e.propsOptions[0])a in o||(o[a]=void 0);n?e.props=s?o:br(o):e.type.props?e.props=o:e.props=l,e.attrs=l}function pu(e,t,n,s){const{props:o,attrs:l,vnode:{patchFlag:a}}=e,r=ve(o),[c]=e.propsOptions;let f=!1;if((s||a>0)&&!(a&16)){if(a&8){const u=e.vnode.dynamicProps;for(let h=0;h<u.length;h++){let w=u[h];if(zs(e.emitsOptions,w))continue;const $=t[w];if(c)if(me(l,w))$!==l[w]&&(l[w]=$,f=!0);else{const D=Ye(w);o[D]=Oo(c,r,D,$,e,!1)}else $!==l[w]&&(l[w]=$,f=!0)}}}else{Zl(e,t,o,l)&&(f=!0);let u;for(const h in r)(!t||!me(t,h)&&((u=tn(h))===h||!me(t,u)))&&(c?n&&(n[h]!==void 0||n[u]!==void 0)&&(o[h]=Oo(c,r,h,void 0,e,!0)):delete o[h]);if(l!==r)for(const h in l)(!t||!me(t,h))&&(delete l[h],f=!0)}f&&It(e.attrs,"set","")}function Zl(e,t,n,s){const[o,l]=e.propsOptions;let a=!1,r;if(t)for(let c in t){if(Wn(c))continue;const f=t[c];let u;o&&me(o,u=Ye(c))?!l||!l.includes(u)?n[u]=f:(r||(r={}))[u]=f:zs(e.emitsOptions,c)||(!(c in s)||f!==s[c])&&(s[c]=f,a=!0)}if(l){const c=ve(n),f=r||xe;for(let u=0;u<l.length;u++){const h=l[u];n[h]=Oo(o,c,h,f[h],e,!me(f,h))}}return a}function Oo(e,t,n,s,o,l){const a=e[n];if(a!=null){const r=me(a,"default");if(r&&s===void 0){const c=a.default;if(a.type!==Function&&!a.skipFactory&&re(c)){const{propsDefaults:f}=o;if(n in f)s=f[n];else{const u=cs(o);s=f[n]=c.call(null,t),u()}}else s=c;o.ce&&o.ce._setProp(n,s)}a[0]&&(l&&!r?s=!1:a[1]&&(s===""||s===tn(n))&&(s=!0))}return s}const hu=new WeakMap;function Ql(e,t,n=!1){const s=n?hu:t.propsCache,o=s.get(e);if(o)return o;const l=e.props,a={},r=[];let c=!1;if(!re(e)){const u=h=>{c=!0;const[w,$]=Ql(h,t,!0);He(a,w),$&&r.push(...$)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!l&&!c)return _e(e)&&s.set(e,un),un;if(te(l))for(let u=0;u<l.length;u++){const h=Ye(l[u]);Oi(h)&&(a[h]=xe)}else if(l)for(const u in l){const h=Ye(u);if(Oi(h)){const w=l[u],$=a[h]=te(w)||re(w)?{type:w}:He({},w),D=$.type;let E=!1,x=!0;if(te(D))for(let S=0;S<D.length;++S){const L=D[S],J=re(L)&&L.name;if(J==="Boolean"){E=!0;break}else J==="String"&&(x=!1)}else E=re(D)&&D.name==="Boolean";$[0]=E,$[1]=x,(E||me($,"default"))&&r.push(h)}}const f=[a,r];return _e(e)&&s.set(e,f),f}function Oi(e){return e[0]!=="$"&&!Wn(e)}const oi=e=>e==="_"||e==="_ctx"||e==="$stable",ii=e=>te(e)?e.map(kt):[kt(e)],vu=(e,t,n)=>{if(t._n)return t;const s=Or((...o)=>ii(t(...o)),n);return s._c=!1,s},ea=(e,t,n)=>{const s=e._ctx;for(const o in e){if(oi(o))continue;const l=e[o];if(re(l))t[o]=vu(o,l,s);else if(l!=null){const a=ii(l);t[o]=()=>a}}},ta=(e,t)=>{const n=ii(t);e.slots.default=()=>n},na=(e,t,n)=>{for(const s in t)(n||!oi(s))&&(e[s]=t[s])},mu=(e,t,n)=>{const s=e.slots=Gl();if(e.vnode.shapeFlag&32){const o=t._;o?(na(s,t,n),n&&pl(s,"_",o,!0)):ea(t,s)}else t&&ta(e,t)},yu=(e,t,n)=>{const{vnode:s,slots:o}=e;let l=!0,a=xe;if(s.shapeFlag&32){const r=t._;r?n&&r===1?l=!1:na(o,t,n):(l=!t.$stable,ea(t,o)),a=t}else t&&(ta(e,t),a={default:1});if(l)for(const r in o)!oi(r)&&a[r]==null&&delete o[r]},ze=ku;function gu(e){return bu(e)}function bu(e,t){const n=Bs();n.__VUE__=!0;const{insert:s,remove:o,patchProp:l,createElement:a,createText:r,createComment:c,setText:f,setElementText:u,parentNode:h,nextSibling:w,setScopeId:$=xt,insertStaticContent:D}=e,E=(g,_,O,U=null,F=null,R=null,q=void 0,K=null,W=!!_.dynamicChildren)=>{if(g===_)return;g&&!Dn(g,_)&&(U=ce(g),Fe(g,F,R,!0),g=null),_.patchFlag===-2&&(W=!1,_.dynamicChildren=null),_.dynamicChildren&&g&&g.dynamicChildren&&g.dynamicChildren.hasOnce&&(_.dynamicChildren===un&&(_.dynamicChildren=[]),_.dynamicChildren.hasOnce=!0);const{type:N,ref:ee,shapeFlag:Y}=_;switch(N){case Js:x(g,_,O,U);break;case Rt:S(g,_,O,U);break;case _s:g==null&&L(_,O,U,q);break;case B:Oe(g,_,O,U,F,R,q,K,W);break;default:Y&1?V(g,_,O,U,F,R,q,K,W):Y&6?G(g,_,O,U,F,R,q,K,W):(Y&64||Y&128)&&N.process(g,_,O,U,F,R,q,K,W,sn)}ee!=null&&F?Yn(ee,g&&g.ref,R,_||g,!_):ee==null&&g&&g.ref!=null&&Yn(g.ref,null,R,g,!0)},x=(g,_,O,U)=>{if(g==null)s(_.el=r(_.children),O,U);else{const F=_.el=g.el;_.children!==g.children&&f(F,_.children)}},S=(g,_,O,U)=>{g==null?s(_.el=c(_.children||""),O,U):_.el=g.el},L=(g,_,O,U)=>{[g.el,g.anchor]=D(g.children,_,O,U,g.el,g.anchor)},J=({el:g,anchor:_},O,U)=>{let F;for(;g&&g!==_;)F=w(g),s(g,O,U),g=F;s(_,O,U)},C=({el:g,anchor:_})=>{let O;for(;g&&g!==_;)O=w(g),o(g),g=O;o(_)},V=(g,_,O,U,F,R,q,K,W)=>{if(_.type==="svg"?q="svg":_.type==="math"&&(q="mathml"),g==null)I(_,O,U,F,R,q,K,W);else{const N=g.el&&g.el._isVueCE?g.el:null;try{N&&N._beginPatch(),T(g,_,F,R,q,K,W)}finally{N&&N._endPatch()}}},I=(g,_,O,U,F,R,q,K)=>{let W,N;const{props:ee,shapeFlag:Y,transition:Q,dirs:ae}=g;if(W=g.el=a(g.type,R,ee&&ee.is,ee),Y&8?u(W,g.children):Y&16&&b(g.children,W,null,U,F,co(g,R),q,K),ae&&on(g,null,U,"created"),A(W,g,g.scopeId,q,U),ee){for(const $e in ee)$e!=="value"&&!Wn($e)&&l(W,$e,null,ee[$e],R,U);"value"in ee&&l(W,"value",null,ee.value,R),(N=ee.onVnodeBeforeMount)&&gt(N,U,g)}ae&&on(g,null,U,"beforeMount");const he=wu(F,Q);he&&Q.beforeEnter(W),s(W,_,O),((N=ee&&ee.onVnodeMounted)||he||ae)&&ze(()=>{N&&gt(N,U,g),he&&Q.enter(W),ae&&on(g,null,U,"mounted")},F)},A=(g,_,O,U,F)=>{if(O&&$(g,O),U)for(let R=0;R<U.length;R++)$(g,U[R]);if(F){let R=F.subTree;if(_===R||la(R.type)&&(R.ssContent===_||R.ssFallback===_)){const q=F.vnode;A(g,q,q.scopeId,q.slotScopeIds,F.parent)}}},b=(g,_,O,U,F,R,q,K,W=0)=>{for(let N=W;N<g.length;N++){const ee=g[N]=K?Pt(g[N]):kt(g[N]);E(null,ee,_,O,U,F,R,q,K)}},T=(g,_,O,U,F,R,q)=>{const K=_.el=g.el;let{patchFlag:W,dynamicChildren:N,dirs:ee}=_;W|=g.patchFlag&16;const Y=g.props||xe,Q=_.props||xe;let ae;if(O&&ln(O,!1),(ae=Q.onVnodeBeforeUpdate)&&gt(ae,O,_,g),ee&&on(_,g,O,"beforeUpdate"),O&&ln(O,!0),N&&(!g.dynamicChildren||g.dynamicChildren.length!==N.length)&&(W=0,q=!1,N=null),(Y.innerHTML&&Q.innerHTML==null||Y.textContent&&Q.textContent==null)&&u(K,""),N?ne(g.dynamicChildren,N,K,O,U,co(_,F),R):q||fe(g,_,K,null,O,U,co(_,F),R,!1),W>0){if(W&16)Se(K,Y,Q,O,F);else if(W&2&&Y.class!==Q.class&&l(K,"class",null,Q.class,F),W&4&&l(K,"style",Y.style,Q.style,F),W&8){const he=_.dynamicProps;for(let $e=0;$e<he.length;$e++){const be=he[$e],Ie=Y[be],Ne=Q[be];(Ne!==Ie||be==="value")&&l(K,be,Ie,Ne,F,O)}}W&1&&g.children!==_.children&&u(K,_.children)}else!q&&N==null&&Se(K,Y,Q,O,F);((ae=Q.onVnodeUpdated)||ee)&&ze(()=>{ae&&gt(ae,O,_,g),ee&&on(_,g,O,"updated")},U)},ne=(g,_,O,U,F,R,q)=>{for(let K=0;K<_.length;K++){const W=g[K],N=_[K],ee=W.el&&(W.type===B||!Dn(W,N)||W.shapeFlag&198)?h(W.el):O;E(W,N,ee,null,U,F,R,q,!0)}},Se=(g,_,O,U,F)=>{if(_!==O){if(_!==xe)for(const R in _)!Wn(R)&&!(R in O)&&l(g,R,_[R],null,F,U);for(const R in O){if(Wn(R))continue;const q=O[R],K=_[R];q!==K&&R!=="value"&&l(g,R,K,q,F,U)}"value"in O&&l(g,"value",_.value,O.value,F)}},Oe=(g,_,O,U,F,R,q,K,W)=>{const N=_.el=g?g.el:r(""),ee=_.anchor=g?g.anchor:r("");let{patchFlag:Y,dynamicChildren:Q,slotScopeIds:ae}=_;ae&&(K=K?K.concat(ae):ae),g==null?(s(N,O,U),s(ee,O,U),b(_.children||[],O,ee,F,R,q,K,W)):Y>0&&Y&64&&Q&&g.dynamicChildren&&g.dynamicChildren.length===Q.length?(ne(g.dynamicChildren,Q,O,F,R,q,K),(_.key!=null||F&&_===F.subTree)&&sa(g,_,!0)):fe(g,_,O,ee,F,R,q,K,W)},G=(g,_,O,U,F,R,q,K,W)=>{_.slotScopeIds=K,g==null?_.shapeFlag&512?F.ctx.activate(_,O,U,q,W):M(_,O,U,F,R,q,W):P(g,_,W)},M=(g,_,O,U,F,R,q)=>{const K=g.component=Au(g,U,F);if(si(g)&&(K.ctx.renderer=sn),Pu(K,!1,q),K.asyncDep){if(F&&F.registerDep(K,z,q),!g.el){const W=K.subTree=we(Rt);S(null,W,_,O),g.placeholder=W.el}}else z(K,g,_,O,F,R,q)},P=(g,_,O)=>{const U=_.component=g.component;if(cu(g,_,O))if(U.asyncDep&&!U.asyncResolved){_.el=g.el,oe(U,_,O);return}else U.next=_,U.update();else _.el=g.el,U.vnode=_},z=(g,_,O,U,F,R,q)=>{const K=()=>{if(g.isMounted){let{next:Y,bu:Q,u:ae,parent:he,vnode:$e}=g;{const mt=oa(g);if(mt){Y&&(Y.el=$e.el,oe(g,Y,q)),mt.asyncDep.then(()=>{ze(()=>{g.isUnmounted||N()},F)});return}}let be=Y,Ie;ln(g,!1),Y?(Y.el=$e.el,oe(g,Y,q)):Y=$e,Q&&bs(Q),(Ie=Y.props&&Y.props.onVnodeBeforeUpdate)&&gt(Ie,he,Y,$e),ln(g,!0);const Ne=Ei(g),vt=g.subTree;g.subTree=Ne,E(vt,Ne,h(vt.el),ce(vt),g,F,R),Y.el=Ne.el,be===null&&du(g,Ne.el),ae&&ze(ae,F),(Ie=Y.props&&Y.props.onVnodeUpdated)&&ze(()=>gt(Ie,he,Y,$e),F)}else{let Y;const{el:Q,props:ae}=_,{bm:he,m:$e,parent:be,root:Ie,type:Ne}=g,vt=zn(_);ln(g,!1),he&&bs(he),!vt&&(Y=ae&&ae.onVnodeBeforeMount)&&gt(Y,be,_),ln(g,!0);{Ie.ce&&Ie.ce._hasShadowRoot()&&Ie.ce._injectChildStyle(Ne,g.parent?g.parent.type:void 0);const mt=g.subTree=Ei(g);E(null,mt,O,U,g,F,R),_.el=mt.el}if($e&&ze($e,F),!vt&&(Y=ae&&ae.onVnodeMounted)){const mt=_;ze(()=>gt(Y,be,mt),F)}(_.shapeFlag&256||be&&zn(be.vnode)&&be.vnode.shapeFlag&256)&&g.a&&ze(g.a,F),g.isMounted=!0,_=O=U=null}};g.scope.on();const W=g.effect=new yl(K);g.scope.off();const N=g.update=W.run.bind(W),ee=g.job=W.runIfDirty.bind(W);ee.i=g,ee.id=g.uid,W.scheduler=()=>ti(ee),ln(g,!0),N()},oe=(g,_,O)=>{_.component=g;const U=g.vnode.props;g.vnode=_,g.next=null,pu(g,_.props,U,O),yu(g,_.children,O),Ft(),_i(g),Nt()},fe=(g,_,O,U,F,R,q,K,W=!1)=>{const N=g&&g.children,ee=g?g.shapeFlag:0,Y=_.children,{patchFlag:Q,shapeFlag:ae}=_;if(Q>0){if(Q&128){ue(N,Y,O,U,F,R,q,K,W);return}else if(Q&256){Z(N,Y,O,U,F,R,q,K,W);return}}ae&8?(ee&16&&H(N,F,R),Y!==N&&u(O,Y)):ee&16?ae&16?ue(N,Y,O,U,F,R,q,K,W):H(N,F,R,!0):(ee&8&&u(O,""),ae&16&&b(Y,O,U,F,R,q,K,W))},Z=(g,_,O,U,F,R,q,K,W)=>{g=g||un,_=_||un;const N=g.length,ee=_.length,Y=Math.min(N,ee);let Q;for(Q=0;Q<Y;Q++){const ae=_[Q]=W?Pt(_[Q]):kt(_[Q]);E(g[Q],ae,O,null,F,R,q,K,W)}N>ee?H(g,F,R,!0,!1,Y):b(_,O,U,F,R,q,K,W,Y)},ue=(g,_,O,U,F,R,q,K,W)=>{let N=0;const ee=_.length;let Y=g.length-1,Q=ee-1;for(;N<=Y&&N<=Q;){const ae=g[N],he=_[N]=W?Pt(_[N]):kt(_[N]);if(Dn(ae,he))E(ae,he,O,null,F,R,q,K,W);else break;N++}for(;N<=Y&&N<=Q;){const ae=g[Y],he=_[Q]=W?Pt(_[Q]):kt(_[Q]);if(Dn(ae,he))E(ae,he,O,null,F,R,q,K,W);else break;Y--,Q--}if(N>Y){if(N<=Q){const ae=Q+1,he=ae<ee?_[ae].el:U;for(;N<=Q;)E(null,_[N]=W?Pt(_[N]):kt(_[N]),O,he,F,R,q,K,W),N++}}else if(N>Q)for(;N<=Y;)Fe(g[N],F,R,!0),N++;else{const ae=N,he=N,$e=new Map;for(N=he;N<=Q;N++){const Ze=_[N]=W?Pt(_[N]):kt(_[N]);Ze.key!=null&&$e.set(Ze.key,N)}let be,Ie=0;const Ne=Q-he+1;let vt=!1,mt=0;const Mn=new Array(Ne);for(N=0;N<Ne;N++)Mn[N]=0;for(N=ae;N<=Y;N++){const Ze=g[N];if(Ie>=Ne){Fe(Ze,F,R,!0);continue}let yt;if(Ze.key!=null)yt=$e.get(Ze.key);else for(be=he;be<=Q;be++)if(Mn[be-he]===0&&Dn(Ze,_[be])){yt=be;break}yt===void 0?Fe(Ze,F,R,!0):(Mn[yt-he]=N+1,yt>=mt?mt=yt:vt=!0,E(Ze,_[yt],O,null,F,R,q,K,W),Ie++)}const fi=vt?_u(Mn):un;for(be=fi.length-1,N=Ne-1;N>=0;N--){const Ze=he+N,yt=_[Ze],pi=_[Ze+1],hi=Ze+1<ee?pi.el||ia(pi):U;Mn[N]===0?E(null,yt,O,hi,F,R,q,K,W):vt&&(be<0||N!==fi[be]?Me(yt,O,hi,2):be--)}}},Me=(g,_,O,U,F=null)=>{const{el:R,type:q,transition:K,children:W,shapeFlag:N}=g;if(N&6){Me(g.component.subTree,_,O,U);return}if(N&128){g.suspense.move(_,O,U);return}if(N&64){q.move(g,_,O,sn);return}if(q===B){s(R,_,O);for(let Y=0;Y<W.length;Y++)Me(W[Y],_,O,U);s(g.anchor,_,O);return}if(q===_s){J(g,_,O);return}if(U!==2&&N&1&&K)if(U===0)K.persisted&&!R[ro]?s(R,_,O):(K.beforeEnter(R),s(R,_,O),ze(()=>K.enter(R),F));else{const{leave:Y,delayLeave:Q,afterLeave:ae}=K,he=()=>{g.ctx.isUnmounted?o(R):s(R,_,O)},$e=()=>{const be=R._isLeaving||!!R[ro];R._isLeaving&&R[ro](!0),K.persisted&&!be?he():Y(R,()=>{he(),ae&&ae()})};Q?Q(R,he,$e):$e()}else s(R,_,O)},Fe=(g,_,O,U=!1,F=!1)=>{const{type:R,props:q,ref:K,children:W,dynamicChildren:N,shapeFlag:ee,patchFlag:Y,dirs:Q,cacheIndex:ae,memo:he}=g;if((Y===-2||N&&N.hasOnce)&&(F=!1),K!=null&&(Ft(),Yn(K,null,O,g,!0),Nt()),ae!=null&&(!g.ctx||g.ctx===_)&&(_.renderCache[ae]=void 0),ee&256){_.ctx.deactivate(g);return}const $e=ee&1&&Q,be=!zn(g);let Ie;if(be&&(Ie=q&&q.onVnodeBeforeUnmount)&&gt(Ie,_,g),ee&6)pe(g.component,O,U);else{if(ee&128){g.suspense.unmount(O,U);return}$e&&on(g,null,_,"beforeUnmount"),ee&64?g.type.remove(g,_,O,sn,U):N&&!N.hasOnce&&(R!==B||Y>0&&Y&64)?H(N,_,O,!1,!0):(R===B&&Y&384||!F&&ee&16)&&H(W,_,O),U&&nn(g)}const Ne=he!=null&&ae==null;(be&&(Ie=q&&q.onVnodeUnmounted)||$e||Ne)&&ze(()=>{Ie&&gt(Ie,_,g),$e&&on(g,null,_,"unmounted"),Ne&&(g.el=null)},O)},nn=g=>{const{type:_,el:O,anchor:U,transition:F}=g;if(_===B){ps(O,U);return}if(_===_s){C(g),F&&!F.persisted&&F.afterLeave&&F.afterLeave();return}const R=()=>{o(O),F&&!F.persisted&&F.afterLeave&&F.afterLeave()};if(g.shapeFlag&1&&F&&!F.persisted){const{leave:q,delayLeave:K}=F,W=()=>q(O,R);K?K(g.el,R,W):W()}else R()},ps=(g,_)=>{let O;for(;g!==_;)O=w(g),o(g),g=O;o(_)},pe=(g,_,O)=>{const{bum:U,scope:F,job:R,subTree:q,um:K,m:W,a:N}=g;Ii(W),Ii(N),U&&bs(U),F.stop(),R?(R.flags|=8,Fe(q,g,_,O)):g.vnode.el&&q&&(q.transition=g.vnode.transition,Fe(q,g,_,O)),K&&ze(K,_),ze(()=>{g.isUnmounted=!0},_)},H=(g,_,O,U=!1,F=!1,R=0)=>{for(let q=R;q<g.length;q++)Fe(g[q],_,O,U,F)},ce=g=>{if(g.shapeFlag&6)return ce(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const _=w(g.anchor||g.el),O=_&&_[Fr];return O?w(O):_};let ot=!1;const In=(g,_,O)=>{let U;g==null?_._vnode&&(Fe(_._vnode,null,null,!0),U=_._vnode.component):E(_._vnode||null,g,_,null,null,null,O),_._vnode=g,ot||(ot=!0,_i(U),Ll(),ot=!1)},sn={p:E,um:Fe,m:Me,r:nn,mt:M,mc:b,pc:fe,pbc:ne,n:ce,o:e};return{render:In,hydrate:void 0,createApp:ou(In)}}function co({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function ln({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function wu(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function sa(e,t,n=!1){const s=e.children,o=t.children;if(te(s)&&te(o))for(let l=0;l<s.length;l++){const a=s[l];let r=o[l];r.shapeFlag&1&&!r.dynamicChildren&&((r.patchFlag<=0||r.patchFlag===32)&&(r=o[l]=Pt(o[l]),r.el=a.el),!n&&r.patchFlag!==-2&&sa(a,r)),r.type===Js&&(r.patchFlag===-1&&(r=o[l]=Pt(r)),r.el=a.el),r.type===Rt&&!r.el&&(r.el=a.el)}}function _u(e){const t=e.slice(),n=[0];let s,o,l,a,r;const c=e.length;for(s=0;s<c;s++){const f=e[s];if(f!==0){if(o=n[n.length-1],e[o]<f){t[s]=o,n.push(s);continue}for(l=0,a=n.length-1;l<a;)r=l+a>>1,e[n[r]]<f?l=r+1:a=r;f<e[n[l]]&&(l>0&&(t[s]=n[l-1]),n[l]=s)}}for(l=n.length,a=n[l-1];l-- >0;)n[l]=a,a=t[a];return n}function oa(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:oa(t)}function Ii(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ia(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?ia(t.subTree):null}const la=e=>e.__isSuspense;function ku(e,t){t&&t.pendingBranch?te(e)?t.effects.push(...e):t.effects.push(e):Pr(e)}const B=Symbol.for("v-fgt"),Js=Symbol.for("v-txt"),Rt=Symbol.for("v-cmt"),_s=Symbol.for("v-stc"),fn=[];let et=null;function p(e=!1){fn.push(et=e?null:[])}function aa(){fn.pop(),et=fn[fn.length-1]||null}let es=1;function Mi(e,t=!1){es+=e,e<0&&et&&t&&(et.hasOnce=!0)}function ra(e){return e.dynamicChildren=es>0?et||un:null,aa(),es>0&&et&&et.push(e),e}function v(e,t,n,s,o,l){return ra(i(e,t,n,s,o,l,!0))}function Je(e,t,n,s,o){return ra(we(e,t,n,s,o,!0))}function ua(e){return e?e.__v_isVNode===!0:!1}function Dn(e,t){return e.type===t.type&&e.key===t.key}const ca=({key:e})=>e??null,ks=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Pe(e)||Ve(e)||re(e)?{i:Qe,r:e,k:t,f:!!n}:e:null);function i(e,t=null,n=null,s=0,o=null,l=e===B?0:1,a=!1,r=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ca(t),ref:t&&ks(t),scopeId:Fl,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:l,patchFlag:s,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Qe};return r?(Ps(c,n),l&128&&e.normalize(c)):n&&(c.shapeFlag|=Pe(n)?8:16),es>0&&!a&&et&&(c.patchFlag>0||l&6)&&c.patchFlag!==32&&et.push(c),c}const we=$u;function $u(e,t=null,n=null,s=0,o=null,l=!1){if((!e||e===Vl)&&(e=Rt),ua(e)){const r=Tn(e,t,!0);return n&&Ps(r,n),es>0&&!l&&et&&(r.shapeFlag&6?et[et.indexOf(e)]=r:et.push(r)),r.patchFlag=-2,r}if(Du(e)&&(e=e.__vccOpts),t){t=xu(t);let{class:r,style:c}=t;r&&!Pe(r)&&(t.class=le(r)),_e(c)&&(ei(c)&&!te(c)&&(c=He({},c)),t.style=Ae(c))}const a=Pe(e)?1:la(e)?128:qs(e)?64:_e(e)?4:re(e)?2:0;return i(e,t,n,s,o,a,l,!0)}function xu(e){return e?ei(e)||Xl(e)?He({},e):e:null}function Tn(e,t,n=!1,s=!1){const{props:o,ref:l,patchFlag:a,children:r,transition:c}=e,f=t?Su(o||{},t):o,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&ca(f),ref:t&&t.ref?n&&l?te(l)?l.concat(ks(t)):[l,ks(t)]:ks(t):l,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:r,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==B?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Tn(e.ssContent),ssFallback:e.ssFallback&&Tn(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&s&&ni(u,c.clone(u)),u}function X(e=" ",t=0){return we(Js,null,e,t)}function $s(e,t){const n=we(_s,null,e);return n.staticCount=t,n}function j(e="",t=!1){return t?(p(),Je(Rt,null,e)):we(Rt,null,e)}function kt(e){return e==null||typeof e=="boolean"?we(Rt):te(e)?we(B,null,e.slice()):ua(e)?Pt(e):we(Js,null,String(e))}function Pt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Tn(e)}function Ps(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(te(t))n=16;else if(typeof t=="object")if(s&65){const o=t.default;o&&(o._c&&(o._d=!1),Ps(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Xl(t)?t._ctx=Qe:o===3&&Qe&&(Qe.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(re(t)){if(s&65){Ps(e,{default:t});return}t={default:t,_ctx:Qe},n=32}else t=String(t),s&64?(n=16,t=[X(t)]):n=8;e.children=t,e.shapeFlag|=n}function Su(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const o in s)if(o==="class")t.class!==s.class&&(t.class=le([t.class,s.class]));else if(o==="style")t.style=Ae([t.style,s.style]);else if(Ns(o)){const l=t[o],a=s[o];a&&l!==a&&!(te(l)&&l.includes(a))?t[o]=l?[].concat(l,a):a:a==null&&l==null&&!Rs(o)&&(t[o]=a)}else o!==""&&(t[o]=s[o])}return t}function gt(e,t,n,s=null){pt(e,t,7,[n,s])}const Cu=ql();let Tu=0;function Au(e,t,n){const s=e.type,o=(t?t.appContext:e.appContext)||Cu,l={uid:Tu++,vnode:e,type:s,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new er(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ql(s,o),emitsOptions:Yl(s,o),emit:null,emitted:null,propsDefaults:xe,inheritAttrs:s.inheritAttrs,ctx:xe,data:xe,props:xe,attrs:xe,slots:xe,refs:xe,setupState:xe,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return l.ctx={_:l},l.root=t?t.root:l,l.emit=lu.bind(null,l),e.ce&&e.ce(l),l}let je=null;const Eu=()=>je||Qe;let Os,ts;{const e=Bs(),t=(n,s)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(s),l=>{o.length>1?o.forEach(a=>a(l)):o[0](l)}};Os=t("__VUE_INSTANCE_SETTERS__",n=>je=n),ts=t("__VUE_SSR_SETTERS__",n=>ns=n)}const cs=e=>{const t=je;return Os(e),e.scope.on(),()=>{e.scope.off(),Os(t)}},Li=()=>{je&&je.scope.off(),Os(null)};function da(e){return e.vnode.shapeFlag&4}let ns=!1;function Pu(e,t=!1,n=!1){t&&ts(t);const{props:s,children:o}=e.vnode,l=da(e);fu(e,s,l,t),mu(e,o,n||t);const a=l?Ou(e,t):void 0;return t&&ts(!1),a}function Ou(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Xr);const{setup:s}=n;if(s){Ft();const o=e.setupContext=s.length>1?Mu(e):null,l=cs(e),a=us(s,e,0,[e.props,o]),r=cl(a);if(Nt(),l(),(r||e.sp)&&!zn(e)&&Ul(e),r){if(a.then(Li,Li),t)return a.then(c=>{ts(!0);try{Di(e,c,t)}finally{ts(!1)}}).catch(c=>{Ws(c,e,0)});e.asyncDep=a}else Di(e,a)}else fa(e)}function Di(e,t,n){re(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:_e(t)&&(e.setupState=Ol(t)),fa(e)}function fa(e,t,n){const s=e.type;e.render||(e.render=s.render||xt);{const o=cs(e);Ft();try{Zr(e)}finally{Nt(),o()}}}const Iu={get(e,t){return Ue(e,"get",""),e[t]}};function Mu(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Iu),slots:e.slots,emit:e.emit,expose:t}}function Gs(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Ol(wr(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Jn)return Jn[n](e)},has(t,n){return n in t||n in Jn}})):e.proxy}function Lu(e,t=!0){return re(e)?e.displayName||e.name:e.name||t&&e.__name}function Du(e){return re(e)&&"__vccOpts"in e}const k=(e,t)=>Sr(e,t,ns),Fu="3.5.43";let Io;const Fi=typeof window<"u"&&window.trustedTypes;if(Fi)try{Io=Fi.createPolicy("vue",{createHTML:e=>e})}catch{}const pa=Io?e=>Io.createHTML(e):e=>e,Nu="http://www.w3.org/2000/svg",Ru="http://www.w3.org/1998/Math/MathML",Et=typeof document<"u"?document:null,Ni=Et&&Et.createElement("template"),Hu={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const o=t==="svg"?Et.createElementNS(Nu,e):t==="mathml"?Et.createElementNS(Ru,e):n?Et.createElement(e,{is:n}):Et.createElement(e);return e==="select"&&s&&s.multiple!=null&&o.setAttribute("multiple",s.multiple),o},createText:e=>Et.createTextNode(e),createComment:e=>Et.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Et.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,o,l){const a=n?n.previousSibling:t.lastChild;if(o&&(o===l||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===l||!(o=o.nextSibling)););else{Ni.innerHTML=pa(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const r=Ni.content;if(s==="svg"||s==="mathml"){const c=r.firstChild;for(;c.firstChild;)r.appendChild(c.firstChild);r.removeChild(c)}t.insertBefore(r,n)}return[a?a.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Uu=Symbol("_vtc");function ju(e,t,n){const s=e[Uu];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Ri=Symbol("_vod"),Bu=Symbol("_vsh"),Vu=Symbol(""),Wu=/(?:^|;)\s*display\s*:/;function Ku(e,t,n){const s=e.style,o=Pe(n);let l=!1;if(n&&!o){if(t)if(Pe(t))for(const a of t.split(";")){const r=a.slice(0,a.indexOf(":")).trim();n[r]==null&&Hn(s,r,"")}else for(const a in t)n[a]==null&&Hn(s,a,"");for(const a in n){a==="display"&&(l=!0);const r=n[a];r!=null?Yu(e,a,!Pe(t)&&t?t[a]:void 0,r)||Hn(s,a,r):Hn(s,a,"")}}else if(o){if(t!==n){const a=s[Vu];a&&(n+=";"+a),s.cssText=n,l=Wu.test(n)}}else t&&e.removeAttribute("style");Ri in e&&(e[Ri]=l?s.display:"",e[Bu]&&(s.display="none"))}const ys=/\s*!important$/;function Hn(e,t,n){if(te(n))n.forEach(s=>Hn(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))ys.test(n)?e.setProperty(t,n.replace(ys,""),"important"):e.setProperty(t,n);else{const s=qu(e,t);ys.test(n)?e.setProperty(tn(s),n.replace(ys,""),"important"):e[s]=n}}const Hi=["Webkit","Moz","ms"],fo={};function qu(e,t){const n=fo[t];if(n)return n;let s=Ye(t);if(s!=="filter"&&s in e)return fo[t]=s;s=Us(s);for(let o=0;o<Hi.length;o++){const l=Hi[o]+s;if(l in e)return fo[t]=l}return t}function Yu(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Pe(s)&&n===s}const Ui="http://www.w3.org/1999/xlink";function ji(e,t,n,s,o,l=Xa(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Ui,t.slice(6,t.length)):e.setAttributeNS(Ui,t,n):n==null||l&&!hl(n)?e.removeAttribute(t):e.setAttribute(t,l?"":St(n)?String(n):n)}function Bi(e,t,n,s,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?pa(n):n);return}const l=e.tagName;if(t==="value"&&l!=="PROGRESS"&&!l.includes("-")){const r=l==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(r!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let a=!1;if(n===""||n==null){const r=typeof e[t];r==="boolean"?n=hl(n):n==null&&r==="string"?(n="",a=!0):r==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(o||t)}function Lt(e,t,n,s){e.addEventListener(t,n,s)}function zu(e,t,n,s){e.removeEventListener(t,n,s)}const Vi=Symbol("_vei");function Ju(e,t,n,s,o=null){const l=e[Vi]||(e[Vi]={}),a=l[t];if(s&&a)a.value=s;else{const[r,c]=Zu(t);if(s){const f=l[t]=tc(s,o);Lt(e,r,f,c)}else a&&(zu(e,r,a,c),l[t]=void 0)}}const Gu=/(Once|Passive|Capture)$/,Xu=/^on:?(?:Once|Passive|Capture)$/;function Zu(e){let t,n;for(;(n=e.match(Gu))&&!Xu.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):tn(e.slice(2)),t]}let po=0;const Qu=Promise.resolve(),ec=()=>po||(Qu.then(()=>po=0),po=Date.now());function tc(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;const o=n.value;if(te(o)){const l=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{l.call(s),s._stopped=!0};const a=o.slice(),r=[s];for(let c=0;c<a.length&&!s._stopped;c++){const f=a[c];f&&pt(f,t,5,r)}}else pt(o,t,5,[s])};return n.value=e,n.attached=ec(),n}const Wi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,nc=(e,t,n,s,o,l)=>{const a=o==="svg";t==="class"?ju(e,s,a):t==="style"?Ku(e,n,s):Ns(t)?Rs(t)||Ju(e,t,n,s,l):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):sc(e,t,s,a))?(Bi(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&ji(e,t,s,a,l,t!=="value")):e._isVueCE&&(oc(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Pe(s)))?Bi(e,Ye(t),s,l,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),ji(e,t,s,a))};function sc(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Wi(t)&&re(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Wi(t)&&Pe(n)?!1:t in e}function oc(e,t){const n=e._def.props;if(!n)return!1;const s=Ye(t);return Array.isArray(n)?n.some(o=>Ye(o)===s):Object.keys(n).some(o=>Ye(o)===s)}const Xt=e=>{const t=e.props["onUpdate:modelValue"]||!1;return te(t)?n=>bs(t,n):t};function ic(e){e.target.composing=!0}function Ki(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const tt=Symbol("_assign"),gs=Symbol("_initialValue");function ho(e,t,n){return t&&(e=e.trim()),n&&(e=js(e)),e}const De={created(e,{modifiers:{lazy:t,trim:n,number:s}},o){e.parentNode&&(e.type==="text"?e[gs]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[gs]=e.defaultValue.replace(/\r\n?/g,`
`))),e[tt]=Xt(o);const l=s||o.props&&o.props.type==="number";Lt(e,t?"change":"input",a=>{a.target.composing||e[tt](ho(e.value,n,l))}),(n||l)&&Lt(e,"change",()=>{e.value=ho(e.value,n,l)}),t||(Lt(e,"compositionstart",ic),Lt(e,"compositionend",Ki),Lt(e,"change",Ki))},mounted(e,{value:t,modifiers:{trim:n,number:s}}){const o=t??"",l=e[gs];delete e[gs],l!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==l?e[tt](ho(e.value,n,s)):e.value=o},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:o,number:l}},a){if(e[tt]=Xt(a),e.composing)return;const r=(l||e.type==="number")&&!/^0\d/.test(e.value)?js(e.value):e.value,c=t??"";if(r===c)return;const f=e.getRootNode();(f instanceof Document||f instanceof ShadowRoot)&&f.activeElement===e&&e.type!=="range"&&(s&&t===n||o&&e.value.trim()===c)||(e.value=c)}},lc={deep:!0,created(e,t,n){e[tt]=Xt(n),Lt(e,"change",()=>{const s=e._modelValue,o=An(e),l=e.checked,a=e[tt];if(te(s)){const r=Yo(s,o),c=r!==-1;if(l&&!c)a(s.concat(o));else if(!l&&c){const f=[...s];f.splice(r,1),a(f)}}else if(Dt(s)){const r=new Set(s);l?r.add(o):r.delete(o),a(r)}else a(ha(e,l))})},mounted:qi,beforeUpdate(e,t,n){e[tt]=Xt(n),qi(e,t,n)}};function qi(e,{value:t,oldValue:n},s){e._modelValue=t;let o;if(te(t))o=Yo(t,s.props.value)>-1;else if(Dt(t))o=t.has(s.props.value);else{if(t===n)return;o=ft(t,ha(e,!0))}e.checked!==o&&(e.checked=o)}const Yi={created(e,{value:t},n){e.checked=ft(t,n.props.value),e[tt]=Xt(n),Lt(e,"change",()=>{e[tt](An(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[tt]=Xt(s),t!==n&&(e.checked=ft(t,s.props.value))}},pn={deep:!0,created(e,{value:t,modifiers:{number:n}},s){e._modelValue=t,Lt(e,"change",()=>{const o=Array.prototype.filter.call(e.options,c=>c.selected).map(c=>n?js(An(c)):An(c)),l=e.multiple,a=l?Dt(e._modelValue)?new Set(o):o:o[0],r=e._pendingValue=[l,l?te(a)?o.slice():o:a];try{e[tt](a)}finally{Ks(()=>{e._pendingValue===r&&(e._pendingValue=void 0)})}}),e[tt]=Xt(s)},mounted(e,{value:t}){zi(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[tt]=Xt(n)},updated(e,{value:t}){const n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!ac(t,n[1],n[0]))&&zi(e,t)}};function ac(e,t,n){if(!n||te(e))return ft(e,t);if(Dt(e)){if(e.size!==t.length)return!1;for(const s of t)if(!e.has(s))return!1;return!0}return!1}function zi(e,t){const n=e.multiple,s=te(t);if(!(n&&!s&&!Dt(t))){for(let o=0,l=e.options.length;o<l;o++){const a=e.options[o],r=An(a);if(n)if(s){const c=typeof r;c==="string"||c==="number"?a.selected=t.some(f=>String(f)===String(r)):a.selected=Yo(t,r)>-1}else a.selected=t.has(r);else if(ft(An(a),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function An(e){return"_value"in e?e._value:e.value}function ha(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const rc=["ctrl","shift","alt","meta"],uc={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>rc.some(n=>e[`${n}Key`]&&!t.includes(n))},ut=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((o,...l)=>{for(let a=0;a<t.length;a++){const r=uc[t[a]];if(r&&r(o,t))return}return e(o,...l)}))},cc={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},va=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=(o=>{if(!("key"in o))return;const l=tn(o.key);if(t.some(a=>a===l||cc[a]===l))return e(o)}))},dc=He({patchProp:nc},Hu);let Ji;function fc(){return Ji||(Ji=gu(dc))}const pc=((...e)=>{const t=fc().createApp(...e),{mount:n}=t;return t.mount=s=>{const o=vc(s);if(!o)return;const l=t._component;!re(l)&&!l.render&&!l.template&&(l.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const a=n(o,!1,hc(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),a},t});function hc(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function vc(e){return Pe(e)?document.querySelector(e):e}const mc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yc=["Su","Mo","Tu","We","Th","Fr","Sa"],ma={clock:"clock-outline",analog:"clock-outline",date:"calendar"},Ke=e=>JSON.stringify(e),ge=e=>String.fromCodePoint(parseInt(e,16));function li(e,t=new Date){let n=t.getHours();return e||(n=n%12||12),`${String(n).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}const ai=(e=new Date)=>`${yc[e.getDay()]} ${e.getDate()} ${mc[e.getMonth()]}`;function gc(e,t=Math.floor(Date.now()/1e3)){const n=t-e,s=Math.abs(n),o=l=>Math.floor(s/l);return n<0?s<3600?`In ${Math.max(1,o(60))} min`:s<86400?o(3600)===1?"In 1 hour":`In ${o(3600)} hours`:s<172800?"Tomorrow":`In ${o(86400)} days`:s<60?"Just now":s<3600?`${o(60)} min ago`:s<86400?o(3600)===1?"1 hour ago":`${o(3600)} hours ago`:s<172800?"Yesterday":s<604800?`${o(86400)} days ago`:s<2592e3?o(604800)===1?"1 week ago":`${o(604800)} weeks ago`:s<31536e3?o(2592e3)===1?"1 month ago":`${o(2592e3)} months ago`:o(31536e3)===1?"1 year ago":`${o(31536e3)} years ago`}const bc={guition:{width:448,top:36,name:27,text:21,icon:26},cyd:{width:298,top:24,name:18,text:14,icon:18}};let Fn;const Mo=new Map,wc=()=>Mo.clear();function rn(e,t){const n=`${t}|${e}`;let s=Mo.get(n);if(!s){if(Fn===void 0&&(Fn=document.createElement("canvas").getContext("2d")),Fn){Fn.font=t;const o=Fn.measureText(e);s={left:-o.actualBoundingBoxLeft,right:o.actualBoundingBoxRight,top:-o.actualBoundingBoxAscent,bottom:o.actualBoundingBoxDescent,advance:o.width}}else{const o=Number(/(\d+(?:\.\d+)?)px/.exec(t)?.[1]||14),l=[...e].length*o*.55;s={left:0,right:l,top:-o*.72,bottom:o*.02,advance:l}}Mo.set(n,s)}return s}const _c=e=>({name:`500 ${e.name}px "Bar Roboto"`,text:`400 ${e.text}px "Bar Roboto"`,icon:`${e.icon}px "Tile Icons"`});function kc(e){return{icon:Math.max(2,Math.floor((e*4+5)/10)),item:Math.max(6,Math.floor((e*125+50)/100)),name:Math.max(8,Math.floor((e*16+5)/10))}}function ya(e,t,n,s){const o=_c(t),l=rn("0",o.text),a=Math.round(l.bottom-l.top),r=kc(a),c=rn(String.fromCodePoint(983376),o.icon),f=Math.round(c.bottom-c.top),u=e.map((C,V)=>{const I=s(C),A={index:V,item:C,view:I,shown:I.shown,width:0};return I.analog?(A.dial=f,A.width=f,A):(I.icon&&(A.icon={glyph:ge(I.icon),ink:rn(ge(I.icon),o.icon)},A.width+=A.icon.ink.right-A.icon.ink.left),I.text&&(A.text={value:I.text,ink:rn(I.text,o.text)},A.width+=(A.icon?r.icon:0)+A.text.ink.right-A.text.ink.left),A)}),h=u.filter(C=>C.shown),w=rn(n,o.name).advance,$=Math.min(w,Math.floor(t.width*35/100)),D=C=>C.reduce((V,I)=>V+I.width,0)+Math.max(0,C.length-1)*r.item;let E=0;for(;E<h.length&&D(h.slice(E))+r.name+$>t.width;)E++;const x=h.slice(E),S=new Set(h.slice(0,E).map(C=>C.index));let L=t.width-D(x);for(const C of x)C.x=L,L+=C.width+r.item;const J=x.length?x[0].x-r.name:t.width;return{metrics:t,fonts:o,cap:a,zero:l,gaps:r,parts:u,placed:x,dropped:S,nameText:n,natural:w,nameRoom:J}}function $c(e,t,n){if(rn(e,t).advance<=n)return e;const s=[...e];for(;s.length&&rn(s.join("")+"...",t).advance>n;)s.pop();return s.join("")+"..."}function xc(e){"fonts"in document&&Promise.all([document.fonts.load('500 27px "Bar Roboto"',"Studio 0"),document.fonts.load('400 21px "Bar Roboto"',"Away 0"),document.fonts.load('26px "Tile Icons"',String.fromCodePoint(983376))]).then(()=>{wc(),e()}).catch(()=>{})}let ga="";function Sc(e){ga=e||""}async function ri(e,t={}){const n=await fetch(`api/${e}`,{...t,headers:{"Content-Type":"application/json","X-Screen-CSRF":ga,...t.headers}});if(!n.ok){let s="That didn't work. Refresh the page and try again.";try{s=(await n.json()).error||s}catch{}throw new Error(s)}return n}const ht=async e=>(await ri(e)).json(),st=async(e,t,n,s={})=>{const l=await(await ri(e,{method:t,body:n===void 0?void 0:JSON.stringify(n),...s})).text();return l?JSON.parse(l):null},Le=6,gn=8,ss=gn*Le,Cc=["single","wide","full"],Zt=e=>e===!0?"wide":e===!1?"single":e,Xs=e=>/^screen\.page_[1-8]$/.test(e)?Number(e.slice(-1)):0,Ge=e=>Cc.includes(e.options?.size)?e.options.size:"single",Lo=e=>Ge(e)!=="single",ba=e=>Ge(e)==="full",wa=e=>e-e%Le,_a=e=>e-e%2,En=e=>Math.floor(e/Le),ui=e=>Zt(e)==="full"?Le:Zt(e)==="wide"?2:1,hn=(e,t)=>Zt(t)==="full"?Array.from({length:Le},(n,s)=>wa(e)+s):Zt(t)==="wide"?[e,e+1]:[e],Gi=(e,t)=>Zt(t)==="full"?wa(e):Zt(t)==="wide"?_a(e):e,nt=e=>e.tiles.map(t=>({tile:t,slot:t.slot}));function ka(e){let t=0;return e.map(n=>{const s=Ge(n);s==="full"&&t%Le?t+=Le-t%Le:s==="wide"&&t%2===1&&t++;const o=t;return t+=ui(s),o})}function Tc(e){const t=ka(e);return e.some((n,s)=>n.slot!==t[s])}function Zs(e){if(e.tiles.some(t=>!Number.isInteger(t.slot))){const t=ka(e.tiles);e.tiles.forEach((n,s)=>n.slot=t[s])}e.tiles.sort((t,n)=>t.slot-n.slot)}function Gn(e){const t=new Set;for(const{tile:n,slot:s}of e)for(const o of hn(s,Ge(n)))t.add(o);return t}const os=(e,t,n)=>Number.isInteger(t)&&t>=0&&t<ss&&(Zt(n)==="full"?t%Le===0:Zt(n)==="wide"?t+1<ss&&!(t%2):!0)&&hn(t,n).every(s=>!e.has(s));function Do(e,t,n=0){for(let s=n;s<ss;s++)if(os(e,s,t))return s;return-1}function $a(e,t,n){let s=-1;for(let o=0;o<ss;o++)os(e,o,t)&&(s<0||Math.abs(o-n)<=Math.abs(s-n))&&(s=o);return s}function xa(e,t,n){const s=Ge(t);if(n=Gi(n,s),!os(new Set,n,s))return null;const o=hn(n,s),l=e.includes(t)?hn(t.slot,s):[],a=[{tile:t,slot:n}],r=[];for(const c of e)c!==t&&(hn(c.slot,Ge(c)).some(f=>o.includes(f))?r.push(c):a.push({tile:c,slot:c.slot}));for(const c of r){const f=Ge(c),u=Gn(a);let h=l.map(w=>Gi(w,f)).find(w=>os(u,w,f));if(h===void 0&&(h=$a(u,f,c.slot)),h<0)return null;a.push({tile:c,slot:h})}return a.sort((c,f)=>c.slot-f.slot)}function jt(e,t=1){const n=Math.max(0,...e.map(({tile:s,slot:o})=>o+ui(Ge(s))));return Math.min(gn,Math.max(1,Math.ceil(n/Le),t||1))}function Ac(e){const t=e.split(".")[0];return t==="sun"?{options:{display:"sunpath",size:"wide"}}:t==="weather"?{options:{display:"forecast",size:"wide"}}:Xs(e)?{}:t==="screen"?{options:{display:"digital",size:"wide"}}:{}}const Sa=e=>({entity:e,name:"",slot:-1,...Ac(e)});function Ca(e,t){const n=e.entity.split(".")[0],s=t.controls?.[n],o=e.options||{};if(!s||!["wide","full"].includes(o.size)||(o.display||"standard")!=="standard"||o.inline==="slider")return null;const l=o.controls??(o.size==="full"?"none":s.default);return l==="none"?null:l}function Ec(e,t){const n=Ca(e,t);return n?t.controls?.[e.entity.split(".")[0]]?.choices.find(s=>s.key===n)?.label.toLocaleLowerCase()||n:"none"}const Fo=e=>(/^(\d+)\.(\d+)\.(\d+)$/.exec(e||"")||[]).slice(1).map(Number);function Qt(e,t){const[n,s]=[Fo(e),Fo(t)];if(n.length!==3||s.length!==3)return!1;for(let o=0;o<3;o++)if(n[o]!==s[o])return n[o]>s[o];return!0}const Pc=(e,t,n,s)=>Qt(e,`${t}.${n}.${s}`),Oc=ss;function Ic(e){return Fo(e).length!==3?10:Qt(e,"0.2.62")?Oc:Qt(e,"0.2.7")?20:10}const Ta={standard:"standard",watch:"large value",forecast:"weather forecast",graph:"graph",digital:"digital clock",analog:"analog clock",sunpath:"sun path"},Mc={single:"normal",wide:"double",full:"full page"},Xi=["light","switch","input_boolean","fan","media_player","climate"],Lc=["light","fan","cover","number","input_number","media_player"],Dc={light:["Light","☀","#ad7600","#fff3d3"],climate:["Climate","❄","#c86620","#ffebdc"],vacuum:["Vacuum","◉","#008577","#def3ed"],fan:["Fan","✣","#008aab","#def5fa"],cover:["Cover","▤","#8053af","#eee5f8"],media_player:["Media","▶","#007cad","#def2fc"],sensor:["Sensor","⌁","#3476b1","#e5effa"],binary_sensor:["Status","◈","#ad7600","#fff3d3"],switch:["Switch","⏻","#ad7600","#fff3d3"],input_boolean:["Switch","⏻","#ad7600","#fff3d3"],scene:["Scene","✦","#8053af","#eee5f8"],script:["Script","▷","#8053af","#eee5f8"],weather:["Weather","☁","#007cad","#def2fc"],number:["Value","±","#008577","#def3ed"],input_number:["Value","±","#008577","#def3ed"],select:["Select","≡","#5862af","#eaecfa"],input_select:["Select","≡","#5862af","#eaecfa"],button:["Action","↗","#5862af","#eaecfa"],input_button:["Action","↗","#5862af","#eaecfa"],screen:["Screen","◷","#25282c","#e9ecf1"],sun:["Sun","☼","#c86620","#ffebdc"],timer:["Timer","⏱","#008577","#def3ed"],person:["Person","☺","#2f7d32","#e1f2e2"],camera:["Camera","◧","#3d4a57","#e6ebf0"],image:["Image","◧","#3d4a57","#e6ebf0"]},wt=e=>Dc[e.split(".")[0]]||["Entity","◇","#637184","#edf0f4"],d=yn({inventory:{screens:[],entities:[]},connected:!1,reachable:!0,selected:null,layout:null,dirty:!1,busy:!1,saved:0,tab:"layout",selectedTile:null,inspector:null,iconPickerOpen:!1,actionPickerOpen:!1,actionSearch:"",insertAt:-1,filter:"",search:"",capabilities:{},entityActions:{},topbarPreviews:{},topbarAdded:null,topbarOverflow:[],settingEdits:{},settingPending:!1,updating:[],toast:null,now:Date.now(),fontsVersion:0,route:location.hash,overrideProfile:null,overrideFriendly:"",drag:{active:!1,moving:null,preview:null},menuOpen:!1,liveStates:{},room:"",hidePlaced:!1,palette:!1,firmwareJob:null}),Tt=k(()=>d.inventory.screens.find(e=>e.id===d.selected)),Aa=k(()=>Tt.value?.firmware||""),Kt=(e,t,n)=>Pc(Aa.value,e,t,n),vn=k(()=>Ic(Aa.value)),ci=k(()=>Tt.value?.board==="guition"),Ea=k(()=>bc[ci.value?"guition":"cyd"]),vo=k(()=>d.selectedTile&&d.layout?d.layout.tiles.find(e=>e.entity===d.selectedTile):void 0);let Zi=0;function ke(e,t){d.toast={message:e,action:t},clearTimeout(Zi),Zi=window.setTimeout(()=>d.toast=null,t?8e3:5e3)}function Fc(){d.toast=null}async function ct(e,t,n="API key"){try{if(!navigator.clipboard||!window.isSecureContext)throw new Error;await navigator.clipboard.writeText(e),ke(`${n} copied.`)}catch{if(t){const s=document.createRange();s.selectNodeContents(t);const o=window.getSelection();o?.removeAllRanges(),o?.addRange(s)}ke(document.execCommand("copy")?`${n} copied.`:`${n} is selected. Copy with Ctrl+C or Command+C.`)}}function Is(){const e="/config/integrations/dashboard";try{window.top.location.assign(e)}catch{window.open(e,"_blank")}}const Nc=["","#settings","#new-screen","#firmware","#alerts","#override"],lt=k(()=>Nc.includes(d.route)?d.route:"");function Ee(e){if(location.hash===e){d.route=e;return}location.hash=e}window.addEventListener("hashchange",()=>{d.route=location.hash,window.scrollTo(0,0)});function ds(e){return d.inventory.entities.find(t=>t.id===e)?.name||d.inventory.builtin?.find(t=>t.id===e)?.name||e}let mo={source:null,byName:{}};function fs(e){return mo.source!==d.inventory.icons&&(mo={source:d.inventory.icons,byName:Object.fromEntries((d.inventory.icons?.groups||[]).flatMap(t=>t.icons.map(n=>[n.name,n])))}),e?mo.byName[e]:void 0}function en(e){const t=d.inventory.icons;if(!t)return"F0335";const n=d.inventory.entities.find(o=>o.id===e),s=e.split(".")[0];return t.builtin?.[e]?t.builtin[e]:n?.icon?n.icon:s==="weather"?t.weather[n?.state||""]||t.weather.partlycloudy:s==="sun"?t.sun[n?.state||""]||t.sun.below_horizon:t.defaults[s]||t.fallback}const Un=e=>fs(e.options?.icon)?.cp||en(e.entity),yo=new Set;async function Qs(e){const t=[...new Set(e)].filter(n=>!yo.has(n)&&!n.startsWith("screen."));if(t.length){t.forEach(n=>yo.add(n));try{for(let n=0;n<t.length;n+=40){const s=t.slice(n,n+40).map(o=>`entity=${encodeURIComponent(o)}`).join("&");Object.assign(d.capabilities,(await ht(`capabilities?${s}`)).capabilities||{})}}catch{t.forEach(n=>yo.delete(n))}}}const go=new Set;async function Rc(e){if(!go.has(e)){go.add(e);try{d.entityActions[e]=(await ht(`entity-actions?entity=${encodeURIComponent(e)}`)).actions}catch{go.delete(e)}}}let bo=!1;async function eo(){const e=[...new Set((d.layout?.tiles||[]).map(t=>t.entity).filter(t=>!t.startsWith("screen.")))];if(!(!e.length||bo)){bo=!0;try{for(let t=0;t<e.length;t+=60){const n=e.slice(t,t+60).map(s=>`entity=${encodeURIComponent(s)}`).join("&");Object.assign(d.liveStates,(await ht(`states?${n}`)).states||{})}}catch{}finally{bo=!1}}}function Hc(e){const t=d.liveStates[e];if(t)return t;const n=d.inventory.entities.find(s=>s.id===e);return n?.state?{state:n.state,word:null,a:{}}:null}function Xe(){d.dirty=!0,d.saved=0}function Pa(e){if(e!==d.selected&&d.dirty&&!confirm("You have unsaved changes. Open a different screen anyway?"))return;e!==d.selected&&(ls(),d.settingEdits={}),d.selected=e,d.selectedTile=null,d.inspector=null,d.tab="layout",d.menuOpen=!1;const t=d.inventory.screens.find(s=>s.id===e);if(!t){d.layout=null;return}const n=JSON.parse(JSON.stringify(t.layout));Zs(n),n.pages=jt(nt(n),n.pages),d.layout=n,d.insertAt=-1,d.dirty=!1,d.saved=0,no(0),Qs(n.tiles.map(s=>s.entity)),eo(),Ee("")}function Uc(e){const t=d.layout,n=t.tiles.map(o=>`${o.entity}@${o.slot}`).join();for(const{tile:o,slot:l}of e)o.slot=l,t.tiles.includes(o)||t.tiles.push(o);Zs(t),t.pages=jt(nt(t),t.pages);const s=t.tiles.map(o=>`${o.entity}@${o.slot}`).join()!==n;return s&&Xe(),s}function to(e,t){if(!d.layout)return!1;Qs([e.entity]);const n=xa(d.layout.tiles,e,t),s=n?Uc(n):!1;return s&&!d.liveStates[e.entity]&&eo(),s}function Oa(e){const t=d.layout;if(!t||t.tiles.some(o=>o.entity===e)||t.tiles.length>=vn.value)return;const n=Sa(e),s=d.insertAt>=0?d.insertAt:Do(Gn(nt(t)),Ge(n));d.insertAt=-1,s>=0&&to(n,s)&&No(e)}function Ia(e){const t=d.layout;if(!t)return;const n=t.tiles.indexOf(e);n<0||(t.tiles.splice(n,1),d.selectedTile===e.entity&&Be(),Xe(),t.pages=jt(nt(t),t.pages),ke(`${e.name||ds(e.entity)} removed`,{label:"Undo",run:()=>to(e,e.slot)}))}function Qi(){const e=d.layout;e&&(e.pages=Math.min(gn,jt(nt(e),e.pages)+1),Xe())}function jc(e){const t=d.layout;if(t){for(const n of t.tiles)En(n.slot)>e&&(n.slot-=Le);t.pages=Math.max(1,jt(nt(t),t.pages)-1),Xe()}}function Bc(){const e=d.layout;if(!e)return 1;const t=d.drag.preview||nt(e),n=jt(t,e.pages);return d.drag.active&&n<gn?n+1:n}function Bt(e,t,n){const s=e.entity.split(".")[0],o=d.capabilities[e.entity],l=Lo(e),a=Ge(e);e.options={...e.options,[t]:n},t==="display"&&n==="watch"&&(e.options.inline="none",d.inventory.controls?.[s]&&(e.options.controls="none")),t==="display"&&["forecast","sunpath"].includes(n)&&(e.options.size="wide"),t==="inline"&&n==="slider"&&(e.options.display="standard",d.inventory.controls?.[s]&&(e.options.controls="none")),t==="controls"&&n!=="none"&&(e.options.display="standard",e.options.inline="none");const r=d.inventory.controls?.[s];t==="size"&&n==="wide"&&o&&r&&!("controls"in e.options)&&!o.controls.includes(r.default)&&(e.options.controls=r.choices.find(f=>f.key!=="none"&&o.controls.includes(f.key))?.key||"none"),Xe();const c=d.layout;if(c){if(ba(e)&&a!=="full"){const f=En(e.slot),u=c.tiles.filter($=>$!==e&&En($.slot)===f),h=Gn(nt(c).filter($=>$.tile!==e&&!u.includes($.tile))),w=[];for(const $ of u){const D=Do(h,Ge($),(f+1)*Le);if(D<0){w.length=0;break}w.push([$,D]);for(const E of hn(D,Ge($)))h.add(E)}if(w.length===u.length){for(const[$,D]of w)$.slot=D;e.slot=f*Le}else{const $=Do(Gn(nt(c).filter(D=>D.tile!==e)),"full");$>=0?e.slot=$:(e.options.size=a,ke("No page is free for a full-page tile. Free a page first."))}}else if(Lo(e)&&!l){const f=Gn(nt(c).filter(w=>w.tile!==e)),u=_a(e.slot),h=os(f,u,"wide")?u:$a(f,"wide",u);h>=0&&(e.slot=h)}Zs(c),c.pages=jt(nt(c),c.pages)}}function Vc(e,t){const n=`screen.page_${t}`;return!d.layout||n===e.entity||!Xs(n)?!1:d.layout.tiles.some(s=>s.entity===n)?(ke(`This screen already has a tile that goes to page ${t}.`),!1):(e.entity=n,d.selectedTile&&(d.selectedTile=n),Xe(),!0)}function No(e){d.selectedTile!==e&&(d.iconPickerOpen=!1,d.actionPickerOpen=!1,d.actionSearch=""),d.selectedTile=e,d.inspector={kind:"tile"},Qs([e])}function Ot(e){d.inspector?.kind==="bar"&&d.inspector.index===e||(d.iconPickerOpen=!1),d.selectedTile=null,d.inspector={kind:"bar",index:e}}function el(){d.selectedTile=null,d.inspector={kind:"bar-add"}}function Be(){d.inspector=null,d.selectedTile=null}async function Ro(){if(!(d.busy||!d.layout||!d.selected)){d.busy=!0;try{const{settings:e,...t}=d.layout;await st(`screens/${encodeURIComponent(d.selected)}`,"PUT",t),d.dirty=!1,d.saved=Date.now(),ke("Saved. Your screen is being updated."),await bn()}catch(e){ke(e.message)}finally{d.busy=!1}}}const mn=e=>!!(e&&e.alert_action&&Qt(e.firmware,d.inventory.alerts?.min_firmware||"0.2.31"));async function Ma(e){try{await st(`screens/${encodeURIComponent(e.id)}/identify`,"POST"),ke(`${e.name} blinks and shows a card for a few seconds.`)}catch(t){ke(t.message)}}async function Wc(e,t){return await st("alerts/test","POST",{screen:e,data:t})}const Kc=["title","tiles","header","pages"];function La(e,t){const n=d.layout;if(!n)return;const s=(Array.isArray(e.tiles)?e.tiles:[]).filter(r=>!!(r&&typeof r=="object"&&typeof r.entity=="string"&&r.entity.includes("."))).map(r=>({entity:r.entity,name:typeof r.name=="string"?r.name:"",slot:Number.isInteger(r.slot)?r.slot:-1,...r.options&&typeof r.options=="object"?{options:{...r.options}}:{}})),o=new Set,l=s.filter(r=>!o.has(r.entity)&&o.add(r.entity)),a=l.slice(0,vn.value);n.tiles=a,e.header&&Array.isArray(e.header.items)?n.header={items:e.header.items.map(r=>({...r}))}:delete n.header,n.pages=Number.isInteger(e.pages)?e.pages:1,Zs(n),n.pages=jt(nt(n),n.pages),Be(),Xe(),Qs(a.map(r=>r.entity)),eo(),no(0),ke(a.length<l.length?`${t}: ${a.length} of ${l.length} tiles fit this screen's firmware. Save & send when it looks right.`:`${t}. Save & send when it looks right.`)}function qc(e){const t=d.inventory.screens.find(n=>n.id===e);!t||!d.layout||La(JSON.parse(JSON.stringify(t.layout)),`Layout of ${t.name} copied`)}function Yc(){const e=d.layout;if(!e)return"";const t={esp_screens_layout:1};for(const n of Kc)e[n]!==void 0&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Da(){const e=Yc();if(!e)return;const t=`${(Tt.value?.name||"screen").toLowerCase().replace(/[^a-z0-9]+/g,"-")}.layout.json`,n=URL.createObjectURL(new Blob([e],{type:"application/json"})),s=document.createElement("a");s.href=n,s.download=t,s.click(),setTimeout(()=>URL.revokeObjectURL(n),5e3),ct(e,void 0,"Layout JSON")}function zc(e){let t;try{t=JSON.parse(e)}catch{ke("That isn't JSON. Export a layout first, or paste one from another ESP Screens.");return}if(!t||typeof t!="object"||!Array.isArray(t.tiles)){ke("No tiles in this file. Expected a layout exported from ESP Screens.");return}La(t,"Layout imported")}function tl(e){const t=d.inventory.updates?.target,n=d.inventory.updates?.changelog;if(!n||!t)return[];const s=e.firmware,o=[];for(const l of n)if(!(Qt(l.firmware,t)&&l.firmware!==t)&&!(s&&Qt(s,l.firmware)))for(const a of l.lines)o.includes(a)||o.push(a);return o}let wo=!1;async function Jc(){if(!wo){wo=!0;try{const e=await ht("firmware");d.firmwareJob={job:e.job,logs:e.logs||[]}}catch{}finally{wo=!1}}}const Ho=()=>d.inventory.screens.some(e=>e.update?.state==="running")||d.updating.length>0;function $n(e){const t=e.update||{};if(!(t.state==="running"||d.updating.includes(e.id)))return null;const n=d.firmwareJob?.job?.stage;return t.phase==="verify"?{percent:78,text:Vn.verify}:t.phase==="settle"?{percent:92,text:Vn.settle}:t.phase==="install"||!t.phase?n==="upload"?{percent:66,text:"Writing the firmware over Wi-Fi…"}:n?{percent:40,text:"Building the firmware…"}:{percent:12,text:Vn.install}:{percent:12,text:Vn[t.phase]||"Starting update…"}}const Ht=()=>d.layout?.header?.items??(d.layout?.settings?.show_clock??!0?[{type:"clock"}]:[]),qt=()=>d.inventory.header?.max_items||6;function is(e){d.layout&&(d.layout.header={items:e},Xe(),no())}let nl=0;function no(e=150){clearTimeout(nl),nl=window.setTimeout(async()=>{const t=Ht();if(t.some(n=>n.type==="entity"))try{const n=await st("header-preview","POST",{header:{items:t}});t.forEach((s,o)=>d.topbarPreviews[Ke(s)]=n.items[o])}catch{}},e)}function jn(e){return e.type==="entity"?ds(e.entity):d.inventory.header?.builtin.find(t=>t.type===e.type)?.label||e.type}function Vt(e){const t=new Date(d.now);if(e.type==="clock")return{text:li(Pn().clock_24h!==!1,t),shown:!0};if(e.type==="date")return{text:ai(t),shown:!0};if(e.type==="analog")return{analog:!0,shown:!0};const n=d.topbarPreviews[Ke(e)];return n?{icon:n.i||null,text:n.k==="ago"?gc(n.e,Math.floor(d.now/1e3)):n.t,color:n.c?`#${n.c}`:null,shown:n.shown}:{icon:e.icon==="none"?null:fs(e.icon)?.cp||en(e.entity),text:"…",shown:!0,loading:!0}}function _o(e,t){const n=[...Ht()];return t<0||t>=n.length||e===t?!1:(n.splice(t,0,...n.splice(e,1)),is(n),!0)}function sl(e){const t=[...Ht()],[n]=t.splice(e,1);n&&(d.inspector?.kind==="bar"&&Be(),is(t),ke(`${jn(n)} removed from the top bar`,{label:"Undo",run:()=>{const s=[...Ht()];s.splice(Math.min(e,s.length),0,n),is(s)}}))}function ko(e){const t=Ht();if(t.length>=qt())return ke(`The top bar has room for ${qt()} items.`);if(t.some(n=>Ke(n)===Ke(e)))return ke("This is already in the top bar.");d.topbarAdded={key:Ke(e),time:Date.now()},is([...t,e]),Ot(t.length)}const Gc=[{title:"Brightness",icon:"F0599",rows:[{key:"brightness",label:"Brightness",kind:"number",min:5,max:100,step:5,unit:"%"},{key:"dark_mode",label:"Dark mode",kind:"toggle"},{key:"standby_enabled",label:"Auto standby",kind:"toggle"},{key:"standby_seconds",label:"Standby after",kind:"duration",min:60,max:86400,needs:"standby_enabled"},{key:"standby_brightness",label:"Standby brightness",kind:"number",min:0,max:100,step:5,unit:"%",needs:"standby_enabled",cap:"brightness"}]},{title:"Night",icon:"F0594",rows:[{key:"night_enabled",label:"Night mode",kind:"toggle"},{key:"night_start",label:"Starts",kind:"moment",needs:"night_enabled"},{key:"night_end",label:"Ends",kind:"moment",needs:"night_enabled"},{key:"night_brightness",label:"Night brightness",kind:"number",min:0,max:100,step:5,unit:"%",needs:"night_enabled",cap:"brightness"}]},{title:"Screen",icon:"F0379",rows:[{key:"clock_24h",label:"Clock",kind:"choice",options:[[!1,"12 hour"],[!0,"24 hour"]]},{key:"auto_home",label:"Back to page 1",kind:"toggle"},{key:"auto_home_seconds",label:"After",kind:"duration",min:30,max:3600,needs:"auto_home"},{key:"home_on_standby",label:"Also on standby",kind:"toggle"},{key:"swipe_pages",label:"Swipe between pages",kind:"toggle"},{key:"rotation",label:"Rotation",kind:"choice",options:[[0,"0°"],[90,"90°"],[180,"180°"],[270,"270°"]]}]}],Fa=4e3;let Yt={},Cn=null,Ms=0,xs=null;const di=()=>Tt.value?.settings;function Pn(){const e=di(),t={...e?.values||{}};for(const[n,s]of Object.entries(d.settingEdits))t[n]=s.value;return t}const Xc=e=>e<300?30:e<900?60:e<3600?300:e<7200?900:1800;function ol(e,t,n,s,o){if(e.kind==="moment"){let r=s&&t%60?Math.floor(t/60)*60+(n>0?60:0):t+n*(s?60:15);return r%=1440,r<0?r+1440:r}const l=e.kind==="duration"?Xc(n<0?t-1:t):e.step,a=e.cap?Math.min(e.max,o[e.cap]):e.max;return Math.min(a,Math.max(e.min,t+n*l))}function Zc(e){if(e<60)return`${e} sec`;if(e<3600)return`${Math.floor(e/60)} min`;const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return n?`${t} h ${String(n).padStart(2,"0")}`:`${t} h`}function Qc(e,t){const n=Math.floor(e/60),s=String(e%60).padStart(2,"0");return t?`${String(n).padStart(2,"0")}:${s}`:`${n%12||12}:${s} ${n<12?"AM":"PM"}`}function ed(e,t){const n=t[e.key];return n==null?"—":e.kind==="number"?`${n}${e.unit||""}`:e.kind==="duration"?Zc(n):e.kind==="moment"?Qc(n,t.clock_24h!==!1):""}function Bn(e,t,n){if(Cn&&Cn!==d.selected&&Object.keys(Yt).length){ls(),ke("Still saving the other screen's settings. Try again in a moment.");return}Cn=d.selected;const s=Pn();if(d.settingEdits[e]={value:t,at:Date.now()},Yt[e]=t,e==="brightness")for(const o of["standby_brightness","night_brightness"])s[o]>t&&(d.settingEdits[o]={value:t,at:Date.now()});d.settingPending=!0,clearTimeout(Ms),Ms=window.setTimeout(()=>ls(),n)}async function ls(e=!1){if(clearTimeout(Ms),xs||!Object.keys(Yt).length||!Cn)return;const t=Cn,n=Yt;Yt={};const s=ri(`screens/${encodeURIComponent(t)}/settings`,{method:"PUT",body:JSON.stringify({settings:n}),keepalive:e});xs=s;try{const o=await(await s).json(),l=d.inventory.screens.find(a=>a.id===t);l&&(l.settings=o)}catch(o){if(ke(o.message),t===d.selected)for(const l of Object.keys(n))delete d.settingEdits[l];if(t===d.selected&&n.brightness!==void 0)for(const l of["standby_brightness","night_brightness"])delete d.settingEdits[l]}finally{xs=null,Object.keys(Yt).length?Ms=window.setTimeout(()=>ls(),150):Cn=null,d.settingPending=!!Object.keys(Yt).length,t===d.selected&&Ls(),setTimeout(()=>{t===d.selected&&Ls()},Fa+100)}}function Ls(){const e=di();for(const[t,n]of Object.entries(d.settingEdits))Yt[t]!==void 0||xs||(e&&e.values[t]===n.value||Date.now()-n.at>Fa)&&delete d.settingEdits[t]}const Vn={install:"Building and installing…",verify:"Waiting for the screen to come back…",settle:"Checking that it stays stable…"};async function Uo(e,t){d.updating.push(e.id);try{await st(`screens/${encodeURIComponent(e.id)}/update`,"POST",t?{host:t}:{}),await bn()}catch(n){d.updating=d.updating.filter(s=>s!==e.id),ke(n.message)}}async function il(){try{await st("updates/run","POST"),await bn()}catch(e){ke(e.message)}}async function td(e){try{await st("updates","PUT",{auto:e}),d.inventory.updates&&(d.inventory.updates.auto=e),ke(e?"Screens will now update automatically at night.":"Automatic updates are off.")}catch(t){ke(t.message)}}async function nd(){try{d.inventory.claude_skill=await st("claude-skill","POST"),ke(d.inventory.claude_skill?.restart?"Skill installed. Restart Claude Code once so it finds the new skills folder.":"Skill installed. Claude Code picks it up right away.")}catch(e){ke(e.message)}}async function bn(e=!0){try{const t=await ht(e?"inventory":"inventory?light=1");d.inventory=e?t:{...d.inventory,...t},t.csrf&&Sc(t.csrf),d.connected=!!d.inventory.connected,d.reachable=!0;for(const n of d.inventory.screens)n.update?.state==="running"&&(d.updating=d.updating.filter(s=>s!==n.id));d.selected&&Ls()}catch{d.reachable=!1}}function sd(e){d.inventory={...d.inventory,...e},d.connected=!!d.inventory.connected;for(const t of d.inventory.screens)t.update?.state==="running"&&(d.updating=d.updating.filter(n=>n!==t.id));d.selected&&Ls()}let ll=0,jo=Date.now(),Ds=!1,Nn=null;function od(){Nn||typeof EventSource>"u"||(Nn=new EventSource("api/events"),Nn.onopen=()=>{Ds=!0,as()},Nn.onmessage=e=>{document.hidden||sd(JSON.parse(e.data))},Nn.onerror=()=>{Ds=!1,as()})}function as(){clearTimeout(ll);const e=Ds?6e4:d.inventory.updates?.busy?3e3:1e4;ll=window.setTimeout(async()=>{if(!document.hidden){const t=Date.now()-jo>=3e5;t&&(jo=Date.now()),(t||!Ds)&&await bn(t)}as()},e)}let al=!1;function id(){al||(al=!0,bn(),od(),as(),xc(()=>d.fontsVersion++),setInterval(()=>{!d.layout||document.hidden||d.drag.active||(d.now=Date.now(),no(0))},3e4),setInterval(()=>{!document.hidden&&d.layout&&d.tab==="layout"&&lt.value===""&&eo()},8e3),setInterval(()=>{!document.hidden&&Ho()?Jc():d.firmwareJob&&!Ho()&&(d.firmwareJob=null)},3e3),document.addEventListener("visibilitychange",async()=>{document.hidden||(jo=Date.now(),d.now=Date.now(),await bn(),as())}),window.addEventListener("pagehide",()=>ls(!0)),window.addEventListener("beforeunload",e=>{d.dirty&&(e.preventDefault(),e.returnValue="")}))}const ld={class:"side"},ad={id:"screens"},rd=["aria-current","onClick"],ud={class:"txt"},cd={key:0,class:"pill"},dd={key:1,class:"spin small"},fd=["onSubmit"],pd=["disabled","title","onClick"],hd={key:2,class:"whatsnew"},vd=["aria-valuenow"],md={class:"progress-text"},yd=["title"],gd=["title"],bd={id:"pending"},wd={class:"pending-actions"},_d=["onClick"],kd=["aria-current"],$d={class:"more"},xd=["aria-current"],Sd={class:"mdi"},Cd=["aria-current"],Td={class:"mdi"},Ad=["aria-current"],Ed={class:"mdi"},Pd=Te({__name:"Sidebar",setup(e){const t=de(null),n=de("");function s(c){const f=c.update||{};return f.state==="running"||d.updating.includes(c.id)?{kind:"running",text:Vn[f.phase||""]||"Starting update…"}:f.state==="queued"?{kind:"queued",text:"Queued for the update"}:f.available&&c.online?{kind:"available",text:`Update ${f.target}`}:f.result&&Date.now()/1e3-f.result.time<86400?{kind:f.result.state==="failed"?"failed":"done",text:f.result.message}:null}function o(c){const f=c.update||{};f.host&&f.profile?Uo(c):f.profile&&(t.value=c.id,n.value="")}function l(c){const f=n.value.trim();f&&(t.value=null,Uo(c,f))}const a=()=>{const c=d.firmwareJob?.logs||[];return c.length?c[c.length-1]:""},r=c=>c.installed?"Installed, but not yet in Home Assistant. Add the discovered ESPHome device under Settings → Devices & services, paste the API key there, and turn on “Allow the device to perform Home Assistant actions” under Configure.":c.downloaded?"Firmware downloaded, not yet in Home Assistant. Put it on the screen with ESPHome Web, then add the discovered ESPHome device under Settings → Devices & services, paste the API key there, and allow the Home Assistant actions under Configure.":`Not yet in Home Assistant. Already flashed? Add the ESPHome device under Settings → Devices & services, then allow the Home Assistant actions under Configure. Not flashed yet? Firmware & USB → ${c.file}.`;return(c,f)=>(p(),v("aside",ld,[f[20]||(f[20]=i("div",{class:"brand"},[i("span",{class:"mark"},"▦"),i("span",null,"ESP Screens")],-1)),i("span",{id:"connection",class:le(["conn",{online:y(d).connected}]),role:"status"},m(y(d).reachable?y(d).connected?"Home Assistant connected":"Reconnecting to Home Assistant…":"Management page unreachable · retrying…"),3),i("button",{type:"button",class:"search-btn",id:"open-palette",onClick:f[0]||(f[0]=u=>y(d).palette=!0)},[...f[10]||(f[10]=[X("⌕ Search",-1),i("kbd",null,"⌘K",-1)])]),f[21]||(f[21]=i("div",{class:"label"},"Screens",-1)),i("div",ad,[(p(!0),v(B,null,ie(y(d).inventory.screens,u=>(p(),v("div",{key:u.id,class:le(["screen-item",{selected:u.id===y(d).selected&&y(lt)===""}])},[i("button",{type:"button",class:"nav-item","aria-current":u.id===y(d).selected&&y(lt)===""?"true":"false",onClick:h=>y(Pa)(u.id)},[i("span",{class:le(["dot",{off:!u.online}])},null,2),i("span",ud,[i("span",null,m(u.name),1),i("small",null,m(u.online?"Online":"Offline")+m(u.area?" · "+u.area:"")+" · "+m(u.firmware||"unknown"),1)]),s(u)?.kind==="available"?(p(),v("span",cd,"Update")):s(u)?.kind==="running"?(p(),v("span",dd)):j("",!0)],8,rd),s(u)?(p(),v("div",{key:0,class:le(["screen-update",s(u).kind])},[s(u).kind==="available"?(p(),v(B,{key:0},[t.value===u.id?(p(),v(B,{key:0},[f[12]||(f[12]=i("small",null,"The IP address, once; new firmware reports it itself.",-1)),i("form",{class:"screen-host",onSubmit:ut(h=>l(u),["prevent"])},[ye(i("input",{"onUpdate:modelValue":f[1]||(f[1]=h=>n.value=h),placeholder:"IP address, e.g. 192.168.1.50",required:"",pattern:"[A-Za-z0-9][A-Za-z0-9.\\-]*","aria-label":"IP address",autofocus:""},null,512),[[De,n.value]]),f[11]||(f[11]=i("button",{type:"submit",class:"btn mini primary"},"Start",-1)),i("button",{type:"button",class:"icon-btn","aria-label":"Cancel",onClick:f[2]||(f[2]=h=>t.value=null)},"✕")],40,fd)],64)):(p(),v(B,{key:1},[i("small",null,m(s(u).text),1),i("button",{type:"button",class:"btn mini primary",disabled:!u.update?.profile,title:u.update?.profile?"":"No ESPHome profile found with this device name.",onClick:h=>o(u)},"Update",8,pd)],64)),y(tl)(u).length?(p(),v("details",hd,[f[13]||(f[13]=i("summary",null,"What's new",-1)),i("ul",null,[(p(!0),v(B,null,ie(y(tl)(u).slice(0,8),h=>(p(),v("li",{key:h},m(h),1))),128))])])):j("",!0)],64)):s(u).kind==="running"&&y($n)(u)?(p(),v(B,{key:1},[i("div",{class:"progress",role:"progressbar","aria-valuenow":y($n)(u).percent,"aria-valuemin":"0","aria-valuemax":"100"},[i("i",{style:Ae({width:y($n)(u).percent+"%"})},null,4)],8,vd),i("div",md,[i("span",null,m(y($n)(u).percent)+" %",1),i("span",{title:a()},m(y($n)(u).text),9,yd)]),a()?(p(),v("small",{key:0,title:a(),style:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"}},m(a()),9,gd)):j("",!0),i("button",{type:"button",class:"btn link mini",style:{"justify-self":"start"},onClick:f[3]||(f[3]=h=>y(Ee)("#firmware"))},"Full log")],64)):(p(),v("small",{key:2,class:le({failed:s(u).kind==="failed"})},m(s(u).text),3))],2)):j("",!0)],2))),128))]),i("div",bd,[(p(!0),v(B,null,ie(y(d).inventory.pending||[],u=>(p(),v("div",{key:u.file,class:"pending"},[i("strong",null,m(u.friendly),1),i("small",null,m(r(u)),1),i("div",wd,[i("button",{type:"button",class:"btn mini quiet",onClick:f[4]||(f[4]=(...h)=>y(Is)&&y(Is)(...h))},"Open Devices & services"),u.api_key?(p(),v("button",{key:0,type:"button",class:"btn mini quiet",onClick:h=>y(ct)(u.api_key)},"Copy API key",8,_d)):j("",!0)])]))),128))]),i("button",{id:"new-screen",type:"button",class:"nav-item ghost","aria-current":y(lt)==="#new-screen"?"true":"false",onClick:f[5]||(f[5]=u=>y(Ee)("#new-screen"))},[...f[14]||(f[14]=[i("span",{class:"plus"},"+",-1),i("span",{class:"txt"},"New screen",-1)])],8,kd),f[22]||(f[22]=i("div",{class:"spacer"},null,-1)),i("div",$d,[f[19]||(f[19]=i("div",{class:"label"},"More",-1)),i("button",{id:"open-firmware",type:"button",class:"nav-item","aria-current":y(lt)==="#firmware"?"true":"false",onClick:f[6]||(f[6]=u=>y(Ee)("#firmware"))},[i("span",Sd,m(y(ge)("F0241")),1),f[15]||(f[15]=i("span",{class:"txt"},"Firmware & USB",-1))],8,xd),i("button",{id:"open-alerts",type:"button",class:"nav-item","aria-current":y(lt)==="#alerts"?"true":"false",onClick:f[7]||(f[7]=u=>y(Ee)("#alerts"))},[i("span",Td,m(y(ge)("F0594")),1),f[16]||(f[16]=i("span",{class:"txt"},"Alerts",-1))],8,Cd),i("button",{id:"open-settings",type:"button",class:"nav-item","aria-current":y(lt)==="#settings"?"true":"false",onClick:f[8]||(f[8]=u=>y(Ee)("#settings"))},[i("span",Ed,m(y(ge)("F0493")),1),f[17]||(f[17]=i("span",{class:"txt"},"Settings",-1))],8,Ad),i("button",{id:"refresh",type:"button",class:"nav-item ghost",onClick:f[9]||(f[9]=u=>y(bn)())},[...f[18]||(f[18]=[i("span",{class:"plus"},"↻",-1),i("span",{class:"txt"},"Refresh",-1)])])])]))}}),Od={key:0,id:"toast",class:"toast",role:"status"},Id=Te({__name:"Toast",setup(e){return(t,n)=>y(d).toast?(p(),v("div",Od,[i("span",null,m(y(d).toast.message),1),y(d).toast.action?(p(),v("button",{key:0,type:"button",onClick:n[0]||(n[0]=s=>{y(d).toast.action.run(),y(Fc)()})},m(y(d).toast.action.label),1)):j("",!0)])):j("",!0)}}),Md={class:"palette-list"},Ld={class:"palette-group"},Dd=["onMouseenter","onClick"],Fd={key:0,class:"mdi"},Nd={key:1,class:"glyph"},Rd={class:"tx"},Hd={key:0},Ud={key:2,class:"hint-key"},jd={key:0,class:"palette-empty"},Bd=Te({__name:"CommandPalette",setup(e){const t=de(""),n=de(0),s=de(null),o=k(()=>{const f=t.value.trim().toLocaleLowerCase(),u=[];for(const $ of d.inventory.screens)u.push({group:"Screens",label:$.name,detail:`${$.online?"Online":"Offline"} · ${$.firmware||"unknown"}`,glyphText:"▦",run:()=>Pa($.id)});const h=Tt.value,w=[{group:"Actions",label:"New screen",detail:"Connect and install",glyphText:"+",run:()=>Ee("#new-screen")},{group:"Actions",label:"Firmware & USB",icon:"F0241",run:()=>Ee("#firmware")},{group:"Actions",label:"Alerts",detail:"Cheatsheet and a test alert",icon:"F0594",run:()=>Ee("#alerts")},{group:"Actions",label:"Settings",detail:"Updates, Claude",icon:"F0493",run:()=>Ee("#settings")}];if(h&&d.layout&&w.unshift({group:"Actions",label:"Save & send",detail:d.dirty?"Unsaved changes":"Nothing to save",key:"⌘S",run:()=>Ro()},{group:"Actions",label:"Layout",detail:h.name,run:()=>{Ee(""),d.tab="layout"}},{group:"Actions",label:"Screen settings",detail:h.name,run:()=>{Ee(""),d.tab="settings"}},{group:"Actions",label:"Identify this screen",detail:mn(h)?"Blinks the backlight and shows a card":"Needs a newer firmware",run:()=>{mn(h)&&Ma(h)}},{group:"Actions",label:"Export layout",detail:"Download and copy as JSON",run:Da}),u.push(...w),h&&d.layout&&f){const $=new Set(d.layout.tiles.map(E=>E.entity)),D=d.layout.tiles.length>=vn.value;for(const E of d.inventory.entities)if(!(E.tile===!1||$.has(E.id))&&`${E.name} ${E.id} ${E.area||""} ${E.device||""}`.toLocaleLowerCase().includes(f)&&(u.push({group:"Add to this screen",label:E.name,detail:[wt(E.id)[0],E.area].filter(Boolean).join(" · "),icon:d.inventory.icons?en(E.id):void 0,run:()=>{D||Oa(E.id)}}),u.length>60))break}return f?u.filter($=>`${$.label} ${$.detail||""}`.toLocaleLowerCase().includes(f)):u}),l=k(()=>{const f=[];return o.value.forEach((u,h)=>{(f.find($=>$.group===u.group)||(f.push({group:u.group,items:[]}),f[f.length-1])).items.push({item:u,index:h})}),f});function a(){d.palette=!1}function r(f){a(),f.run()}function c(f){if(f.key==="Escape")f.preventDefault(),a();else if(f.key==="ArrowDown")f.preventDefault(),n.value=Math.min(o.value.length-1,n.value+1);else if(f.key==="ArrowUp")f.preventDefault(),n.value=Math.max(0,n.value-1);else if(f.key==="Enter"){f.preventDefault();const u=o.value[n.value];u&&r(u)}}return dn(t,()=>n.value=0),dn(()=>d.palette,async f=>{f&&(t.value="",n.value=0,await Ks(),s.value?.focus())}),(f,u)=>y(d).palette?(p(),v("div",{key:0,class:"palette-backdrop",onClick:a},[i("div",{class:"palette",role:"dialog","aria-label":"Search",onClick:u[1]||(u[1]=ut(()=>{},["stop"])),onKeydown:c},[ye(i("input",{ref_key:"input",ref:s,"onUpdate:modelValue":u[0]||(u[0]=h=>t.value=h),id:"palette-input",placeholder:"Search screens, entities, actions…","aria-label":"Search",autocomplete:"off"},null,512),[[De,t.value]]),i("div",Md,[(p(!0),v(B,null,ie(l.value,h=>(p(),v(B,{key:h.group},[i("div",Ld,m(h.group),1),(p(!0),v(B,null,ie(h.items,({item:w,index:$})=>(p(),v("button",{key:$,type:"button",class:le(["palette-item",{active:$===n.value}]),onMouseenter:D=>n.value=$,onClick:D=>r(w)},[w.icon?(p(),v("span",Fd,m(y(ge)(w.icon)),1)):(p(),v("span",Nd,m(w.glyphText||"›"),1)),i("span",Rd,[i("span",null,m(w.label),1),w.detail?(p(),v("small",Hd,m(w.detail),1)):j("",!0)]),w.key?(p(),v("kbd",Ud,m(w.key),1)):j("",!0)],42,Dd))),128))],64))),128)),o.value.length?j("",!0):(p(),v("p",jd,"Nothing matches. Type part of a screen, entity or action."))])],32)])):j("",!0)}}),se={source:null,element:null,ghost:null,timer:0,start:null,offset:{x:0,y:0},pointerId:null,suppressUntil:0,last:null,scroller:0,target:null},Na={mounted(e,t){e.__dragSource=t.value,e.addEventListener("pointerdown",s=>{const o=e.__dragSource;if(!(s.button!==0||e.disabled||s.target.closest(".remove"))){s.pointerType!=="touch"&&s.preventDefault(),Object.assign(se,{source:o,element:e,start:{x:s.clientX,y:s.clientY},pointerId:s.pointerId});try{e.setPointerCapture(s.pointerId)}catch{}clearTimeout(se.timer),s.pointerType==="touch"&&(se.timer=window.setTimeout(()=>rl(s),260))}}),e.addEventListener("pointermove",s=>{if(d.drag.active||!se.start||se.element!==e)return;const o=Math.hypot(s.clientX-se.start.x,s.clientY-se.start.y);if(s.pointerType==="touch"){o>10&&(clearTimeout(se.timer),se.start=null);return}o>=6&&rl(s)});const n=()=>{se.element===e&&!d.drag.active&&(clearTimeout(se.timer),se.start=null)};e.addEventListener("pointerup",n),e.addEventListener("pointercancel",n)},updated(e,t){e.__dragSource=t.value}};function rl(e){if(d.drag.active||!se.start||!se.source||!se.element)return;d.drag.active=!0,d.drag.moving=se.source.kind==="tile"?se.source.tile:Sa(se.source.id),d.drag.preview=null,se.target=null,getSelection()?.removeAllRanges();const t=se.element.getBoundingClientRect(),n=se.element.cloneNode(!0);n.classList.add("drag-ghost"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,se.offset={x:e.clientX-t.left,y:e.clientY-t.top},document.body.append(n),se.ghost=n,document.addEventListener("pointermove",Bo),document.addEventListener("pointerup",Fs),document.addEventListener("pointercancel",Fs);try{se.element.releasePointerCapture(se.pointerId)}catch{}try{document.documentElement.setPointerCapture(se.pointerId)}catch{}document.addEventListener("touchmove",Ra,{passive:!1}),se.scroller=window.setInterval(()=>{if(!se.last)return;const s=document.querySelector(".canvas");if(!s)return;const o=s.getBoundingClientRect(),l=se.last.x<o.left+60?-12:se.last.x>o.right-60?12:0,a=se.last.y<o.top+60?-12:se.last.y>o.bottom-60?12:0;(l||a)&&(s.scrollBy(l,a),Vo(Ha(se.last.x,se.last.y)))},16),Vo(-1),Bo(e)}function Ra(e){d.drag.active&&e.preventDefault()}function Fs(e){e.pointerId===se.pointerId&&Vd(e.type==="pointerup")}function Bo(e){!se.ghost||e.pointerId!==se.pointerId||(se.last={x:e.clientX,y:e.clientY},se.ghost.style.transform=`translate(${e.clientX-se.offset.x}px, ${e.clientY-se.offset.y}px)`,Vo(Ha(e.clientX,e.clientY)))}function Ha(e,t){let n=null,s=1/0;for(const l of document.querySelectorAll(".pages [data-slot]")){const a=l.getBoundingClientRect(),r=Math.hypot(Math.max(a.left-e,0,e-a.right),Math.max(a.top-t,0,t-a.bottom));r<s&&(s=r,n={cell:l,r:a})}if(!n||s>16)return-1;let o=Number(n.cell.dataset.slot);return n.cell.classList.contains("wide")&&e>(n.r.left+n.r.right)/2&&(o+=1),o}function Vo(e){se.target===e||!d.layout||!d.drag.moving||(se.target=e,d.drag.preview=e>=0?xa(d.layout.tiles,d.drag.moving,e):null)}function Vd(e){const t=d.drag.preview,n=d.drag.moving;document.removeEventListener("pointermove",Bo),document.removeEventListener("pointerup",Fs),document.removeEventListener("pointercancel",Fs),document.removeEventListener("touchmove",Ra);try{document.documentElement.releasePointerCapture(se.pointerId)}catch{}if(se.ghost?.remove(),Object.assign(se,{ghost:null,suppressUntil:Date.now()+400,last:null,start:null,target:null,element:null,source:null}),clearInterval(se.scroller),d.drag.active=!1,d.drag.preview=null,d.drag.moving=null,e&&t&&n&&d.layout){const s=d.layout.tiles.map(o=>`${o.entity}@${o.slot}`).join();for(const{tile:o,slot:l}of t)o.slot=l,d.layout.tiles.includes(o)||d.layout.tiles.push(o);d.layout.tiles.sort((o,l)=>o.slot-l.slot),d.layout.tiles.map(o=>`${o.entity}@${o.slot}`).join()!==s&&Xe(),s.includes(`${n.entity}@`)||to(n,n.slot)}}window.addEventListener("click",e=>{Date.now()<se.suppressUntil&&(e.stopPropagation(),e.preventDefault())},!0);const Wd=["data-slot","tabindex","role","aria-label"],Kd={class:"clockface",viewBox:"0 0 60 60","aria-hidden":"true"},qd=["transform"],Yd=["transform"],zd=["transform"],Jd={key:0,class:"lead"},Gd={class:"tx"},Xd={class:"nm"},Zd={class:"st"},Qd={class:"ic mdi"},ef={class:"lead"},tf={class:"big"},nf={class:"nm"},sf={class:"lead"},of={class:"nm"},lf={key:0,class:"goto"},af={key:1,class:"big"},rf={key:0},uf={key:1,class:"ctl"},cf={key:1,class:"stp"},df={class:"mdi"},ff={class:"mdi"},pf={class:"key mdi"},hf={class:"key mdi"},vf={class:"key mdi"},mf={class:"key mdi"},yf={class:"key mdi"},gf={class:"key mdi"},bf={class:"key mdi"},wf={key:5,class:"run"},_f={class:"lead"},kf={class:"tx"},$f={class:"nm"},xf={key:0,class:"goto"},Sf={key:1,class:"big"},Cf={key:0},Tf={key:1,class:"ctl"},Af={key:1,class:"stp"},Ef={class:"mdi"},Pf={class:"mdi"},Of={class:"key mdi"},If={class:"key mdi"},Mf={key:3,class:"stp"},Lf={class:"mdi"},Df={class:"mdi"},Ff={class:"key mdi"},Nf={class:"key mdi"},Rf={class:"key mdi"},Hf={class:"key mdi"},Uf={class:"key mdi"},jf={class:"key mdi"},Bf={class:"key mdi"},Vf={class:"key mdi"},Wf={class:"key mdi"},Kf={class:"key mdi"},qf={class:"key mdi"},Yf={class:"key mdi"},zf={class:"key mdi"},Jf={class:"key mdi"},Gf={class:"key mdi"},Xf={key:10,class:"run"},Zf={class:"tx"},Qf={class:"nm"},ep={key:0,class:"goto"},tp={key:0,class:"big"},np={key:0},sp=["aria-label"],op=Te({__name:"TileCard",props:{tile:{},slot:{},placeholder:{type:Boolean}},setup(e){const t=e,n=k(()=>t.tile.name||ds(t.tile.entity)),s=k(()=>ba(t.tile)),o=k(()=>Lo(t.tile)&&!s.value),l=k(()=>Xs(t.tile.entity)),a=k(()=>d.inventory.backgrounds?.[t.tile.options?.background||""]?.color),r=k(()=>t.tile.options?.background==="none"),c=k(()=>t.tile.options?.display||"standard"),f=k(()=>c.value!=="standard"?Ta[c.value]||c.value:""),u=k(()=>Ca(t.tile,d.inventory)),h=k(()=>t.tile.entity.split(".")[0]),w=k(()=>d.inventory.icons?.controls||{}),$=Z=>w.value[Z]?ge(w.value[Z]):"",D=k(()=>d.selectedTile===t.tile.entity&&d.inspector?.kind==="tile"),E=k(()=>!t.placeholder&&d.layout?.tiles.includes(t.tile)),x=k(()=>`${n.value}, slot ${t.slot%Le+1} on page ${En(t.slot)+1}. Enter: configure, arrow keys: move`),S=k(()=>new Date(d.now)),L=k(()=>(S.value.getHours()%12+S.value.getMinutes()/60)*30),J=k(()=>S.value.getMinutes()*6),C=k(()=>h.value==="screen"?null:Hc(t.tile.entity)),V=k(()=>!C.value||["unavailable","unknown",""].includes(C.value.state)),I=k(()=>!!C.value&&!V.value&&C.value.state!=="off"&&C.value.state!=="closed"&&C.value.state!=="standby"&&C.value.state!=="idle"&&C.value.state!=="docked"),A=k(()=>["light","switch","input_boolean","fan"].includes(h.value)&&C.value?.state==="on"),b=k(()=>C.value?.a?.unit_of_measurement),T=Z=>Z.charAt(0).toUpperCase()+Z.slice(1).replace(/_/g," "),ne={"clear-night":"Clear, night",cloudy:"Cloudy",exceptional:"Exceptional",fog:"Fog",hail:"Hail",lightning:"Lightning","lightning-rainy":"Lightning, rainy",partlycloudy:"Partly cloudy",pouring:"Pouring",rainy:"Rainy",snowy:"Snowy","snowy-rainy":"Snowy, rainy",sunny:"Sunny",windy:"Windy","windy-variant":"Windy"},Se=["scene","script","button","input_button"],Oe=k(()=>{const Z=C.value;if(!Z||Se.includes(h.value))return f.value;if(V.value)return Z.state==="unknown"?"Unknown":"Unavailable";const ue=Z.a||{};return h.value==="climate"?`${ue.current_temperature!==void 0?`${ue.current_temperature}° · `:""}${Z.word||T(Z.state)}`:h.value==="weather"?`${Z.word||ne[Z.state]||T(Z.state)}${ue.temperature!==void 0?` · ${ue.temperature}°`:""}`:h.value==="cover"&&ue.current_position!==void 0&&ue.current_position>0&&ue.current_position<100?`${Z.word||T(Z.state)} · ${ue.current_position} %`:h.value==="media_player"&&ue.media_title?`${Z.word||T(Z.state)} · ${ue.media_title}`:h.value==="sensor"?`${Z.state}${b.value?` ${b.value}`:""}`:(h.value==="timer",Z.word||T(Z.state))}),G=k(()=>C.value&&!V.value?C.value.state:"—"),M=k(()=>{const Z=C.value;if(!Z||V.value)return 0;const ue=Z.a||{};if(h.value==="light")return Z.state==="on"?ue.brightness!==void 0?Math.round(ue.brightness/255*100):100:0;if(h.value==="fan")return Z.state==="on"?ue.percentage??100:0;if(h.value==="cover")return ue.current_position??(Z.state==="open"?100:0);if(h.value==="media_player")return Math.round((ue.volume_level??0)*100);if(h.value==="number"||h.value==="input_number"){const Me=Number(Z.state),Fe=Number(ue.min??0),nn=Number(ue.max??100);return Number.isFinite(Me)&&nn>Fe?Math.round((Me-Fe)/(nn-Fe)*100):0}return 0}),P=k(()=>({background:`linear-gradient(to right, ${M.value?"#ffbf38":"#c9ccd1"} ${M.value}%, ${M.value?"#fff1d3":"#e6e8ec"} ${M.value}%)`})),z=k(()=>({background:`linear-gradient(to right, #2196f3 ${M.value}%, #d3e8fb ${M.value}%)`})),oe=k(()=>{const Z=C.value?.a?.temperature;return Z!=null?`${Z}°`:"—"});async function fe(Z){if(Z.key==="Enter"||Z.key===" "){Z.preventDefault(),No(t.tile.entity);return}const ue={ArrowLeft:-1,ArrowRight:1,ArrowUp:-2,ArrowDown:2}[Z.key];ue&&(Z.preventDefault(),to(t.tile,t.tile.slot+(s.value?Math.sign(ue)*Le:o.value?Math.sign(ue)*2:ue))&&(await Ks(),document.querySelector(`.pages [data-slot="${t.tile.slot}"]`)?.focus()))}return(Z,ue)=>ye((p(),v("div",{class:le(["tile",{wide:o.value,full:s.value,bare:r.value,placeholder:e.placeholder||!E.value,chosen:D.value}]),"data-slot":e.slot,style:Ae(a.value&&!r.value?{backgroundColor:a.value}:void 0),tabindex:E.value?0:-1,role:E.value?"button":void 0,"aria-label":E.value?x.value:void 0,onClick:ue[1]||(ue[1]=Me=>E.value&&y(No)(e.tile.entity)),onKeydown:ue[2]||(ue[2]=Me=>E.value&&fe(Me))},[c.value==="analog"?(p(),v(B,{key:0},[(p(),v("svg",Kd,[ue[3]||(ue[3]=i("circle",{cx:"30",cy:"30",r:"27",fill:"#fff",stroke:"#c9ccd1"},null,-1)),(p(),v(B,null,ie([0,90,180,270],Me=>i("line",{key:Me,x1:"30",y1:"5",x2:"30",y2:"9",stroke:"#1b1b1b","stroke-width":"1.5",transform:`rotate(${Me} 30 30)`},null,8,qd)),64)),i("line",{x1:"30",y1:"30",x2:"30",y2:"16",stroke:"#1b1b1b","stroke-width":"2.4","stroke-linecap":"round",transform:`rotate(${L.value} 30 30)`},null,8,Yd),i("line",{x1:"30",y1:"30",x2:"30",y2:"11",stroke:"#1b1b1b","stroke-width":"1.6","stroke-linecap":"round",transform:`rotate(${J.value} 30 30)`},null,8,zd),ue[4]||(ue[4]=i("circle",{cx:"30",cy:"30",r:"1.8",fill:"#1b1b1b"},null,-1))])),o.value?(p(),v("span",Jd,[i("span",Gd,[i("span",Xd,m(n.value),1),i("span",Zd,m(f.value),1)])])):j("",!0)],64)):c.value==="digital"&&h.value==="screen"?(p(),v(B,{key:1},[i("span",Qd,m(y(ge)(y(Un)(e.tile))),1),i("span",ef,[i("span",tf,m(String(S.value.getHours()).padStart(2,"0"))+":"+m(String(S.value.getMinutes()).padStart(2,"0")),1),i("span",nf,m(n.value),1)])],64)):s.value?(p(),v(B,{key:2},[i("span",{class:le(["ic mdi",{lit:A.value}])},m(y(ge)(y(Un)(e.tile))),3),i("span",sf,[i("span",of,m(n.value),1),l.value?(p(),v("span",lf,"Page "+m(l.value)+" ›",1)):c.value==="watch"?(p(),v("span",af,[X(m(G.value),1),b.value&&!V.value?(p(),v("small",rf,m(b.value),1)):j("",!0)])):Oe.value?(p(),v("span",{key:2,class:le(["st",{off:V.value}])},m(Oe.value),3)):j("",!0)]),e.tile.options?.inline==="slider"?(p(),v("span",{key:0,class:"mini-slider",style:Ae(P.value)},null,4)):j("",!0),u.value?(p(),v("span",uf,[u.value==="toggle"?(p(),v("span",{key:0,class:le(["tog",{off:!I.value}])},null,2)):u.value==="setpoint"?(p(),v("span",cf,[i("span",df,m($("minus")||"−"),1),i("b",null,m(oe.value),1),i("span",ff,m($("plus")||"+"),1)])):u.value==="volume"?(p(),v(B,{key:2},[i("span",{class:"range",style:Ae(z.value)},null,4),i("span",pf,m($("volume-high")),1)],64)):u.value==="playback"?(p(),v(B,{key:3},[i("span",hf,m($("skip-previous")),1),i("span",vf,m($(I.value?"pause":"play")||$("play")),1),i("span",mf,m($("skip-next")),1)],64)):u.value==="buttons"&&h.value==="cover"?(p(),v(B,{key:4},[i("span",yf,m($("arrow-expand-horizontal")),1),i("span",gf,m($("stop")),1),i("span",bf,m($("arrow-collapse-horizontal")),1)],64)):u.value==="run"?(p(),v("span",wf,m({scene:"Activate",script:"Run"}[h.value]||"Press"),1)):(p(),v("span",{key:6,class:"range",style:Ae({background:`linear-gradient(to right, #2196f3 ${M.value}%, #d3e8fb ${M.value}%)`})},null,4))])):j("",!0)],64)):o.value?(p(),v(B,{key:3},[i("span",_f,[i("span",{class:le(["ic mdi",{lit:A.value}])},m(y(ge)(y(Un)(e.tile))),3),i("span",kf,[i("span",$f,m(n.value),1),l.value?(p(),v("span",xf,"Page "+m(l.value)+" ›",1)):c.value==="watch"?(p(),v("span",Sf,[X(m(G.value),1),b.value&&!V.value?(p(),v("small",Cf,m(b.value),1)):j("",!0)])):Oe.value?(p(),v("span",{key:2,class:le(["st",{off:V.value}])},m(Oe.value),3)):j("",!0)])]),e.tile.options?.inline==="slider"?(p(),v("span",{key:0,class:"mini-slider",style:Ae(P.value)},null,4)):j("",!0),u.value?(p(),v("span",Tf,[u.value==="toggle"?(p(),v("span",{key:0,class:le(["tog",{off:!I.value}])},null,2)):u.value==="setpoint"?(p(),v("span",Af,[i("span",Ef,m($("minus")||"−"),1),i("b",null,m(oe.value),1),i("span",Pf,m($("plus")||"+"),1)])):u.value==="stepper"&&h.value.endsWith("select")?(p(),v(B,{key:2},[i("span",Of,m($("chevron-left")),1),i("span",If,m($("chevron-right")),1)],64)):u.value==="stepper"?(p(),v("span",Mf,[i("span",Lf,m($("minus")||"−"),1),i("b",null,m(G.value),1),i("span",Df,m($("plus")||"+"),1)])):u.value==="mode"?(p(),v(B,{key:4},[i("span",Ff,m($("power")),1),i("span",Nf,m($("fire")),1),i("span",Rf,m($("snowflake")),1)],64)):u.value==="volume"?(p(),v(B,{key:5},[i("span",{class:"range",style:Ae(z.value)},null,4),i("span",Hf,m($("volume-high")),1)],64)):u.value==="playback"?(p(),v(B,{key:6},[i("span",Uf,m($("skip-previous")),1),i("span",jf,m($(I.value?"pause":"play")||$("play")),1),i("span",Bf,m($("skip-next")),1)],64)):u.value==="buttons"&&h.value==="cover"?(p(),v(B,{key:7},[i("span",Vf,m($("arrow-expand-horizontal")),1),i("span",Wf,m($("stop")),1),i("span",Kf,m($("arrow-collapse-horizontal")),1)],64)):u.value==="buttons"&&h.value==="vacuum"?(p(),v(B,{key:8},[i("span",qf,m($("play")),1),i("span",Yf,m($("stop")),1),i("span",zf,m($("home-map-marker")),1)],64)):u.value==="buttons"&&h.value==="timer"?(p(),v(B,{key:9},[i("span",Jf,m($("play")),1),i("span",Gf,m($("close")),1)],64)):u.value==="run"?(p(),v("span",Xf,m({scene:"Activate",script:"Run"}[h.value]||"Press"),1)):(p(),v("span",{key:11,class:"range",style:Ae({background:`linear-gradient(to right, #2196f3 ${M.value}%, #d3e8fb ${M.value}%)`})},null,4))])):j("",!0)],64)):(p(),v(B,{key:4},[i("span",{class:le(["head",{top:c.value==="watch"}])},[i("span",{class:le(["ic mdi",{lit:A.value}])},m(y(ge)(y(Un)(e.tile))),3),i("span",Zf,[i("span",Qf,m(n.value),1),l.value?(p(),v("span",ep,"Page "+m(l.value)+" ›",1)):c.value!=="watch"&&Oe.value?(p(),v("span",{key:1,class:le(["st",{off:V.value}])},m(Oe.value),3)):j("",!0)])],2),c.value==="watch"?(p(),v("span",tp,[X(m(G.value),1),b.value&&!V.value?(p(),v("small",np,m(b.value),1)):j("",!0)])):j("",!0),e.tile.options?.inline==="slider"?(p(),v("span",{key:1,class:"mini-slider",style:Ae(P.value)},null,4)):j("",!0)],64)),E.value?(p(),v("button",{key:5,type:"button",class:"remove",title:"Remove tile","aria-label":`Remove ${n.value}`,onClick:ue[0]||(ue[0]=ut(Me=>y(Ia)(e.tile),["stop"]))},"✕",8,sp)):j("",!0)],46,Wd)),[[y(Na),{kind:"tile",tile:e.tile}]])}}),ip=["viewBox","aria-label"],lp=["y"],ap=["cx","cy","r","stroke","stroke-width"],rp=["x1","y1","x2","y2","stroke","stroke-width"],up=["x","y","fill"],cp=["x","y"],Ua=Te({__name:"TopbarSvg",props:{items:{},nameText:{},single:{type:Boolean}},setup(e,{expose:t}){const n=e,s=k(()=>{d.fontsVersion,d.now,d.topbarPreviews;const x=n.items||Ht();return ya(x,Ea.value,n.nameText??(d.layout?.title||"Home"),Vt)}),o=k(()=>s.value.metrics),l=k(()=>n.single?Math.round(o.value.text*1.4):o.value.top+Math.round(o.value.name*.45)),a=k(()=>n.single?Math.round(o.value.text*1.05):o.value.top),r=k(()=>{if(!n.single)return s.value.placed;const x=s.value.parts[0];return x&&(x.x=0),x?[x]:[]}),c=k(()=>n.single?`-2 0 ${Math.max(1,r.value[0]?.width||1)+4} ${l.value}`:`0 0 ${o.value.width} ${l.value}`),f=k(()=>a.value+(s.value.zero.top+s.value.zero.bottom)/2),u=k(()=>$c(s.value.nameText,s.value.fonts.name,Math.min(s.value.natural,s.value.nameRoom))),h=k(()=>new Date(d.now));function w(x){const S=h.value;return[[(S.getHours()%12+S.getMinutes()/60)*30,x*.24],[S.getMinutes()*6,x*.34]].map(([L,J])=>{const C=L*Math.PI/180;return{x2:J*Math.sin(C),y2:-J*Math.cos(C)}})}const $=x=>x.x-x.icon.ink.left,D=x=>(x.icon?x.x+(x.icon.ink.right-x.icon.ink.left)+s.value.gaps.icon:x.x)-x.text.ink.left,E=k(()=>`${(Math.max(1,r.value[0]?.width||1)+4)*(26/o.value.icon)}px`);return t({lay:s}),(x,S)=>(p(),v("svg",{viewBox:c.value,role:"img","aria-label":e.single?"How it looks on the screen":`Top bar: ${s.value.nameText}`,style:Ae(e.single?{width:E.value}:void 0)},[e.single?j("",!0):(p(),v("text",{key:0,x:"0",y:o.value.top,fill:"#1b1b1b",style:Ae({font:s.value.fonts.name})},m(u.value),13,lp)),i("g",null,[(p(!0),v(B,null,ie(r.value,L=>(p(),v(B,{key:L.index},[L.dial?(p(),v(B,{key:0},[i("circle",{cx:L.x+L.dial/2,cy:f.value,r:L.dial/2-Math.max(1,Math.round(L.dial/10))/2,fill:"none",stroke:L.view.color||"#46525e","stroke-width":Math.max(1,Math.round(L.dial/10))},null,8,ap),(p(!0),v(B,null,ie(w(L.dial),(J,C)=>(p(),v("line",{key:C,x1:L.x+L.dial/2,y1:f.value,x2:L.x+L.dial/2+J.x2,y2:f.value+J.y2,stroke:L.view.color||"#46525e","stroke-width":Math.max(1,Math.round(L.dial*.075)),"stroke-linecap":"round"},null,8,rp))),128))],64)):(p(),v(B,{key:1},[L.icon?(p(),v("text",{key:0,x:$(L),y:f.value-(L.icon.ink.top+L.icon.ink.bottom)/2,fill:L.view.color||"#46525e",style:Ae({font:s.value.fonts.icon})},m(L.icon.glyph),13,up)):j("",!0),L.text?(p(),v("text",{key:1,x:D(L),y:a.value,fill:"#46525e",style:Ae({font:s.value.fonts.text})},m(L.text.value),13,cp)):j("",!0)],64))],64))),128))])],12,ip))}}),dp={class:"page"},fp={class:"page-label"},pp={key:1},hp={class:"tiles"},vp=["data-slot","aria-label","onClick"],mp=Te({__name:"DevicePage",props:{page:{},entries:{},pages:{},moving:{}},setup(e){const t=e,n=k(()=>new Map(t.entries.map(f=>[f.slot,f]))),s=k(()=>new Set(t.entries.flatMap(f=>hn(f.slot,Ge(f.tile)).slice(1)))),o=k(()=>Array.from({length:Le},(f,u)=>t.page*Le+u).filter(f=>!s.value.has(f))),l=k(()=>t.pages>1&&!t.entries.some(f=>En(f.slot)===t.page)),a=k(()=>d.inspector?.kind==="bar"||d.inspector?.kind==="bar-add"),r=k(()=>t.entries.filter(f=>En(f.slot)===t.page).reduce((f,u)=>f+ui(Ge(u.tile)),0));function c(f){const u=d.insertAt===f;d.insertAt=u?-1:f,d.insertAt>=0&&document.querySelector("#search")?.focus()}return(f,u)=>(p(),v("div",dp,[i("div",fp,[i("span",null,"Page "+m(e.page+1),1),l.value?(p(),v("button",{key:0,type:"button",class:"btn mini",title:"The pages after this one shift up one slot",onClick:u[0]||(u[0]=h=>y(jc)(e.page))},"Remove page")):(p(),v("span",pp,m(r.value)+" / "+m(y(Le)),1))]),i("div",{class:le(["device",{cyd:!y(ci)}])},[i("div",{class:le(["bar-wrap",{selected:a.value}]),title:"Edit top bar",role:"button",tabindex:"0",onClick:u[1]||(u[1]=h=>y(Ot)(0)),onKeydown:u[2]||(u[2]=va(ut(h=>y(Ot)(0),["prevent"]),["enter"]))},[we(Ua)],34),i("div",hp,[(p(!0),v(B,null,ie(o.value,h=>(p(),v(B,{key:h},[n.value.get(h)?(p(),Je(op,{key:0,tile:n.value.get(h).tile,slot:h,placeholder:n.value.get(h).tile===e.moving},null,8,["tile","slot","placeholder"])):(p(),v("button",{key:1,type:"button",class:le(["cell",{"insert-here":y(d).insertAt===h}]),"data-slot":h,title:"Empty slot. Click to add a tile here, or drag one over.","aria-label":`Empty slot ${h%y(Le)+1} on page ${e.page+1}: add the next tile here`,onClick:w=>c(h)},[u[3]||(u[3]=i("span",null,"+",-1)),i("small",null,m(y(d).insertAt===h?"Next tile goes here":"Empty"),1)],10,vp))],64))),128))])],2)]))}}),yp={class:"library",id:"library"},gp={class:"lib-head"},bp={class:"lib-title"},wp={class:"filters",id:"filters"},_p=["aria-pressed","onClick"],kp={class:"lib-row"},$p=["value"],xp=["aria-pressed"],Sp={class:"lib-list",id:"results","aria-live":"polite"},Cp=["title","disabled","onClick"],Tp={class:"tx"},Ap={key:0,class:"hint"},Ep={key:1,class:"hint"},Pp={class:"lib-foot"},Op=Te({__name:"Library",setup(e){const t=[["","All"],["light","Lights"],["climate","Climate"],["switch","Switches"],["binary_sensor","Status"],["button","Actions"],["script","Scripts"],["fan","Fans"],["cover","Covers"],["scene","Scenes"],["vacuum","Vacuum"],["sensor","Sensors"],["media_player","Media"],["weather","Weather"],["number","Values"],["select","Selects"],["person","People"],["timer","Timers"],["screen","Screen"]],n={switch:"input_boolean",number:"input_number",select:"input_select",weather:"sun",button:"input_button"},s=k(()=>new Set(d.layout?.tiles.map(f=>f.entity)||[])),o=k(()=>[...new Set(d.inventory.entities.map(f=>f.area).filter(f=>!!f))].sort((f,u)=>f.localeCompare(u))),l=k(()=>{const f=d.search.toLocaleLowerCase(),u=d.filter,h=d.room;return[...d.inventory.builtin||[],...d.inventory.entities].filter(w=>w.tile!==!1&&(ci.value||!["camera","image"].includes(w.id.split(".")[0]))&&(!u||w.id.startsWith(u+".")||n[u]===w.id.split(".")[0])&&(!h||w.area===h)&&(!d.hidePlaced||!s.value.has(w.id))&&`${w.name} ${w.id} ${w.device||""} ${w.area||""}`.toLocaleLowerCase().includes(f))}),a=k(()=>(d.layout?.tiles.length||0)>=vn.value),r=k(()=>d.inventory.entities.length),c=f=>{const u=f.id.split(".")[0];return f.state==="unavailable"||f.state==="unknown"?"gone":["light","switch","input_boolean","fan"].includes(u)&&f.state==="on"?"on":""};return(f,u)=>(p(),v("aside",yp,[i("div",gp,[i("div",bp,[u[3]||(u[3]=X("Library ",-1)),i("small",null,m(r.value)+" entities",1)]),ye(i("input",{id:"search","onUpdate:modelValue":u[0]||(u[0]=h=>y(d).search=h),type:"search",placeholder:"Search by name, device, or room…",autocomplete:"off","aria-label":"Add an entity"},null,512),[[De,y(d).search]]),i("div",wp,[(p(),v(B,null,ie(t,([h,w])=>i("button",{key:h,type:"button","aria-pressed":y(d).filter===h?"true":"false",onClick:$=>y(d).filter=h},[h?(p(),v("span",{key:0,class:"domain-icon",style:Ae({color:y(wt)(h+".")[2],background:y(wt)(h+".")[3]}),"aria-hidden":"true"},m(y(wt)(h+".")[1]),5)):j("",!0),X(m(w),1)],8,_p)),64))]),i("div",kp,[ye(i("select",{id:"room","onUpdate:modelValue":u[1]||(u[1]=h=>y(d).room=h),"aria-label":"Room"},[u[4]||(u[4]=i("option",{value:""},"All rooms",-1)),(p(!0),v(B,null,ie(o.value,h=>(p(),v("option",{key:h,value:h},m(h),9,$p))),128))],512),[[pn,y(d).room]]),i("button",{type:"button",class:"chip-toggle",id:"hide-placed","aria-pressed":y(d).hidePlaced?"true":"false",title:"Hide what is already on this screen",onClick:u[2]||(u[2]=h=>y(d).hidePlaced=!y(d).hidePlaced)},"Hide placed",8,xp)])]),i("div",Sp,[(p(!0),v(B,null,ie(l.value.slice(0,80),h=>ye((p(),v("button",{key:h.id,type:"button",class:"ent",title:h.id,disabled:s.value.has(h.id)||a.value,onClick:w=>y(Oa)(h.id)},[i("span",{class:le(["av mdi",c(h)]),style:Ae({color:y(wt)(h.id)[2],background:y(wt)(h.id)[3]})},m(y(d).inventory.icons?y(ge)(y(en)(h.id)):y(wt)(h.id)[1]),7),i("span",Tp,[i("b",null,m(h.name),1),i("small",null,m([y(wt)(h.id)[0],h.area,h.device].filter(Boolean).join(" · ")),1)]),i("span",{class:le(["add",{done:s.value.has(h.id)}])},m(s.value.has(h.id)?"✓":"+"),3)],8,Cp)),[[y(Na),{kind:"entity",id:h.id}]])),128)),l.value.length?l.value.length>80?(p(),v("p",Ep,m(l.value.length)+" results. Keep typing to narrow it down.",1)):j("",!0):(p(),v("p",Ap,m(y(d).hidePlaced&&!y(d).search&&!y(d).filter&&!y(d).room?"Everything here is already on this screen.":"No entities found. Try a different name, room or filter."),1))]),i("div",Pp,m(a.value?`This screen holds ${y(vn)} tiles${y(vn)<48?"; update its firmware for 48":""}.`:"Drag onto a page, or tap + to add to the first free slot. ⌘K searches everything."),1)]))}}),Ip={class:"canvas-head"},Mp={id:"count"},Lp={key:0,id:"no-tiles"},Dp={key:1},Fp={key:2,id:"positions-hint",class:"warn"},Np={class:"pages",id:"layout-preview","aria-label":"Screen layout"},Rp={class:"page-label"},Hp=["tabindex"],Up=Te({__name:"LayoutView",setup(e){const t=k(()=>d.layout),n=k(()=>d.drag.preview||nt(t.value)),s=k(()=>jt(n.value,t.value.pages)),o=k(()=>Bc()),l=k(()=>s.value<gn),a=k(()=>Tc(t.value.tiles)&&!Kt(0,2,26)?`Empty slots and fixed positions work from firmware 0.2.26. This screen (firmware ${Tt.value?.firmware||"unknown"}) shifts the tiles up to the first free slot until that update.`:"");function r(c){c.target.closest(".device, .page-label, .canvas-head")||d.inspector&&Be()}return(c,f)=>(p(),v(B,null,[i("div",{class:"canvas",id:"canvas",onClick:r},[i("div",Ip,[i("b",Mp,m(s.value)+" "+m(s.value===1?"page":"pages")+" · "+m(t.value.tiles.length)+" / "+m(y(vn))+" tiles",1),t.value.tiles.length?(p(),v("span",Dp,"Tap the top bar or a tile to change it. Drag to move; drop on the next page for a new one.")):(p(),v("span",Lp,"Add your first light, scene, or device from the library.")),a.value?(p(),v("span",Fp,m(a.value),1)):j("",!0)]),i("div",Np,[(p(!0),v(B,null,ie(o.value,u=>(p(),Je(mp,{key:u,page:u-1,entries:n.value,pages:s.value,moving:y(d).drag.moving},null,8,["page","entries","pages","moving"]))),128)),i("div",{class:le(["page ghost",{disabled:!l.value}])},[i("div",Rp,[i("span",null,"Page "+m(o.value+1),1)]),i("div",{class:le(["device",{cyd:y(Tt)?.board!=="guition"}]),id:"add-page",role:"button",tabindex:l.value?0:-1,onClick:f[0]||(f[0]=u=>l.value&&y(Qi)()),onKeydown:f[1]||(f[1]=va(ut(u=>l.value&&y(Qi)(),["prevent"]),["enter"]))},m(l.value?"+ Add page":`${y(gn)} pages is the most`),43,Hp)],2)])]),we(Op)],64))}}),jp={class:"status",id:"settings-status",role:"status"},Bp={key:0,class:"set-grid",id:"settings-groups"},Vp={class:"mdi"},Wp=["data-setting","title","onClick"],Kp=["id"],qp={class:"s-control"},Yp=["id","aria-checked","aria-labelledby","disabled","onClick"],zp=["aria-labelledby"],Jp=["aria-pressed","disabled","onClick"],Gp={key:2,class:"step"},Xp=["aria-label","disabled","onPointerdown","onClick"],Zp={class:"mdi"},Qp=["id","aria-labelledby"],eh=["aria-label","disabled","onPointerdown","onClick"],th={class:"mdi"},nh=Te({__name:"SettingsTab",setup(e){const t=k(()=>di()),n=k(()=>Pn()),s=k(()=>t.value?.owner==="screen"&&!Tt.value?.online),o=k(()=>Gc.map(D=>({...D,rows:D.rows.filter(E=>t.value?.keys.includes(E.key))})).filter(D=>D.rows.length)),l=D=>s.value||!!t.value?.unavailable.includes(D.key),a=D=>D.needs?!!n.value[D.needs]:!0,r=k(()=>s.value?"This screen is offline. Its settings can change once it's back.":d.settingPending?"Saving…":t.value?.owner==="screen"?"Changes apply on the screen at once, and show up here when they change there.":"Changes apply at once. Firmware 0.2.49 lets the screen keep them itself."),c=(D,E)=>{const x=n.value[D.key];return l(D)||!a(D)||x===null||x===void 0?!0:D.kind!=="moment"&&ol(D,x,E,!1,n.value)===x},f=new WeakMap;function u(D,E,x){const S=Pn(),L=ol(D,S[D.key],E,x,S);L!==S[D.key]&&Bn(D.key,L,600)}function h(D,E,x){const S=D.currentTarget;if(S.disabled||D.button!==0)return;const L={timer:0,held:!1};f.set(S,L);let J=0;L.timer=window.setTimeout(function C(){L.held=!0,J+=1,u(E,x,J>5),L.timer=window.setTimeout(C,180)},450)}function w(D){const E=f.get(D.currentTarget);E&&clearTimeout(E.timer)}function $(D,E,x){const S=f.get(D.currentTarget);if(S?.held){S.held=!1;return}u(E,x,!1)}return(D,E)=>(p(),v("div",{class:le(["settings",{offline:s.value}]),id:"general-settings"},[i("span",jp,m(r.value),1),t.value?(p(),v("div",Bp,[(p(!0),v(B,null,ie(o.value,x=>(p(),v("section",{key:x.title,class:"set-card"},[i("h4",null,[i("span",Vp,m(y(ge)(x.icon)),1),X(m(x.title),1)]),(p(!0),v(B,null,ie(x.rows,S=>(p(),v("div",{key:S.key,class:le(["srow",[`setting-${S.kind}`,{inactive:!a(S)||l(S)}]]),"data-setting":S.key,title:l(S)&&!s.value?"This entity is off in Home Assistant, or the screen is restarting.":"",onClick:L=>S.kind==="toggle"&&L.target.closest(".srow")===L.currentTarget&&!L.target.closest("button")&&!l(S)&&y(Bn)(S.key,!n.value[S.key],150)},[i("span",{class:"s-label",id:`setting-label-${S.key}`},m(S.label),9,Kp),i("div",qp,[S.kind==="toggle"?(p(),v("button",{key:0,type:"button",class:le(["switch",{unknown:n.value[S.key]===null||n.value[S.key]===void 0}]),role:"switch",id:`setting-${S.key}`,"aria-checked":n.value[S.key]?"true":"false","aria-labelledby":`setting-label-${S.key}`,disabled:l(S),onClick:ut(L=>y(Bn)(S.key,!n.value[S.key],150),["stop"])},null,10,Yp)):S.kind==="choice"?(p(),v("div",{key:1,class:"seg",role:"group","aria-labelledby":`setting-label-${S.key}`},[(p(!0),v(B,null,ie(S.options,([L,J])=>(p(),v("button",{key:String(L),type:"button","aria-pressed":n.value[S.key]===L?"true":"false",disabled:l(S),onClick:C=>y(Bn)(S.key,L,150)},m(J),9,Jp))),128))],8,zp)):(p(),v("div",Gp,[i("button",{type:"button","aria-label":`${S.label} lower`,disabled:c(S,-1),onPointerdown:L=>h(L,S,-1),onPointerup:w,onPointercancel:w,onPointerleave:w,onClick:L=>$(L,S,-1)},[i("span",Zp,m(y(ge)("F0374")),1)],40,Xp),i("output",{id:`setting-${S.key}`,"aria-labelledby":`setting-label-${S.key}`},m(y(ed)(S,n.value)),9,Qp),i("button",{type:"button","aria-label":`${S.label} higher`,disabled:c(S,1),onPointerdown:L=>h(L,S,1),onPointerup:w,onPointercancel:w,onPointerleave:w,onClick:L=>$(L,S,1)},[i("span",th,m(y(ge)("F0415")),1)],40,eh)]))])],10,Wp))),128))]))),128))])):j("",!0)],2))}}),sh={class:"seg wrap",role:"group"},oh=["disabled","aria-pressed","onClick"],it=Te({__name:"Segmented",props:{choices:{},value:{},disabled:{type:Boolean}},emits:["pick"],setup(e,{emit:t}){const n=t;return(s,o)=>(p(),v("div",sh,[(p(!0),v(B,null,ie(e.choices,([l,a])=>(p(),v("button",{key:String(l),type:"button",disabled:e.disabled,"aria-pressed":String(l)===String(e.value)?"true":"false",onClick:r=>n("pick",l)},m(a),9,oh))),128))]))}}),ih={class:"f"},lh={key:0},ah={key:1,class:"warn"},rh=["aria-expanded"],uh={class:"tx"},ch={key:0,class:"mono"},dh={class:"link"},fh={key:0,class:"picker"},ph={class:"action-list"},hh=["aria-pressed","onClick"],vh={key:0,class:"hint"},mh={key:1,class:"warn"},yh={class:"f-label"},gh=["aria-label","value","onChange"],bh=["value"],wh={key:3,class:"action-number"},_h=["aria-label","value","onInput"],kh=["onClick"],$h={key:4,class:"action-number"},xh=["aria-label","min","max","step","value","placeholder","onInput"],Sh={key:0},Ch=["aria-label","value","placeholder","onInput"],Th={key:6},Ah={key:0,class:"warn"},Eh={key:3},Ph=Te({__name:"ActionPicker",props:{tile:{}},setup(e){const t=e,n=k(()=>d.entityActions[t.tile.entity]),s=k(()=>t.tile.options?.action),o=k(()=>n.value?.find(C=>C.action===s.value?.action)),l=k(()=>d.actionPickerOpen||!s.value),a=k(()=>{const C=d.actionSearch.trim().toLocaleLowerCase();return(n.value||[]).filter(V=>`${V.name} ${V.action} ${V.description}`.toLocaleLowerCase().includes(C))});n.value===void 0&&Rc(t.tile.entity);function r(C){const V=C.action===s.value?.action;t.tile.options={...t.tile.options,action:V?s.value:{action:C.action}},d.actionPickerOpen=!1,Xe()}function c(C,V){const I={...t.tile.options?.action?.data||{}};V===void 0?delete I[C]:I[C]=V,t.tile.options={...t.tile.options,action:{action:s.value.action,...Object.keys(I).length?{data:I}:{}}},Xe()}const f=k(()=>{if(!o.value)return[];const C=t.tile.options?.action?.data||{};return o.value.fields.filter(V=>V.required&&C[V.key]===void 0).map(V=>V.name)}),u=C=>Object.keys(C.selector||{})[0]||"text",h=C=>(C.selector||{})[u(C)]||{},w=C=>C.example===void 0?"":typeof C.example=="string"?C.example:JSON.stringify(C.example);function $(C){const V=h(C),I=u(C);return Array.isArray(C.options)?C.options.map(A=>[A,A]):I==="select"&&Array.isArray(V.options)&&!V.multiple?V.options.map(A=>A&&typeof A=="object"?[String(A.value),String(A.label??A.value)]:[String(A),String(A)]):null}const D=C=>"#"+C.map(V=>Math.max(0,Math.min(255,Number(V)||0)).toString(16).padStart(2,"0")).join(""),E=C=>Array.isArray(C)&&C.length===3?D(C):"#ffffff",x=C=>C===void 0?"":typeof C=="string"?C:JSON.stringify(C);function S(C,V){const I=V.trim();if(!I)return c(C.key,void 0);if(u(C)==="text")return c(C.key,V);try{c(C.key,JSON.parse(I))}catch{c(C.key,V)}}function L(C,V){c(C.key,V===""||!Number.isFinite(Number(V))?void 0:Number(V))}const J=C=>h(C).unit_of_measurement||u(C)==="color_temp"&&h(C).unit||"";return(C,V)=>(p(),v("div",ih,[V[3]||(V[3]=i("span",{class:"f-label"},"Action",-1)),n.value===void 0?(p(),v("small",lh,"Asking Home Assistant which actions this entity has…")):n.value===null?(p(),v("small",ah,"Home Assistant isn't answering right now. Try again in a moment.")):(p(),v(B,{key:2},[i("button",{type:"button",class:"row","aria-expanded":l.value?"true":"false",onClick:V[0]||(V[0]=I=>y(d).actionPickerOpen=!l.value)},[i("span",uh,[i("b",null,m(o.value?o.value.name:s.value?s.value.action:"Choose an action"),1),s.value?(p(),v("small",ch,m(s.value.action),1)):j("",!0)]),i("span",dh,m(l.value?"Close":"Change"),1)],8,rh),l.value?(p(),v("div",fh,[ye(i("input",{"onUpdate:modelValue":V[1]||(V[1]=I=>y(d).actionSearch=I),type:"search",placeholder:"Search, for example toggle, position, or play","aria-label":"Search for an action"},null,512),[[De,y(d).actionSearch]]),i("div",ph,[(p(!0),v(B,null,ie(a.value,I=>(p(),v("button",{key:I.action,type:"button",class:"action-choice","aria-pressed":I.action===s.value?.action?"true":"false",onClick:A=>r(I)},[i("strong",null,m(I.name),1),i("small",null,m(I.description?`${I.action} · ${I.description}`:I.action),1)],8,hh))),128)),a.value.length?j("",!0):(p(),v("p",vh,"No action found."))])])):j("",!0),s.value&&!o.value?(p(),v("small",mh,"Home Assistant doesn't offer this action for this entity any more, so a tap does nothing. Choose another one.")):j("",!0),o.value&&!l.value?(p(),v(B,{key:2},[(p(!0),v(B,null,ie(o.value.fields,I=>(p(),v("div",{key:I.key,class:"f"},[i("span",yh,m(I.required?I.name:`${I.name} (optional)`),1),u(I)==="boolean"?(p(),Je(it,{key:0,choices:[["","Not set"],["true","On"],["false","Off"]],value:s.value?.data?.[I.key]===void 0?"":String(s.value?.data?.[I.key]),onPick:A=>c(I.key,A===""?void 0:A==="true")},null,8,["value","onPick"])):$(I)&&$(I).length<=4?(p(),Je(it,{key:1,choices:[["","Not set"],...$(I)],value:s.value?.data?.[I.key]===void 0?"":String(s.value?.data?.[I.key]),onPick:A=>c(I.key,A===""?void 0:A)},null,8,["choices","value","onPick"])):$(I)?(p(),v("select",{key:2,"aria-label":I.name,value:String(s.value?.data?.[I.key]??""),onChange:A=>c(I.key,A.target.value===""?void 0:A.target.value)},[V[2]||(V[2]=i("option",{value:""},"Not set",-1)),(p(!0),v(B,null,ie($(I),([A,b])=>(p(),v("option",{key:A,value:A},m(b),9,bh))),128))],40,gh)):u(I)==="color_rgb"?(p(),v("div",wh,[i("input",{type:"color","aria-label":I.name,value:E(s.value?.data?.[I.key]),onInput:A=>c(I.key,[1,3,5].map(b=>parseInt(A.target.value.slice(b,b+2),16)))},null,40,_h),i("button",{type:"button",class:"btn quiet mini",onClick:A=>c(I.key,void 0)},"Not set",8,kh)])):u(I)==="number"||u(I)==="color_temp"?(p(),v("div",$h,[i("input",{type:"number","aria-label":I.name,min:h(I).min,max:h(I).max,step:h(I).step==="any"?"any":h(I).step,value:s.value?.data?.[I.key]??"",placeholder:w(I),onInput:A=>L(I,A.target.value)},null,40,xh),J(I)?(p(),v("span",Sh,m(J(I)),1)):j("",!0)])):(p(),v("input",{key:5,type:"text","aria-label":I.name,value:x(s.value?.data?.[I.key]),placeholder:w(I),onInput:A=>S(I,A.target.value)},null,40,Ch)),I.description?(p(),v("small",Th,m(I.description),1)):j("",!0)]))),128)),f.value.length?(p(),v("small",Ah,"Home Assistant needs "+m(f.value.join(", "))+".",1)):j("",!0)],64)):j("",!0),y(Kt)(0,2,58)?j("",!0):(p(),v("small",Eh,"The screen performs an action from firmware 0.2.58: press Update on the screen. Until then a tap works as Automatic."))],64))]))}}),Oh={class:"f"},Ih=["aria-expanded"],Mh={class:"av mdi"},Lh={class:"tx"},Dh={class:"link"},Fh={key:0,class:"picker"},Nh=["aria-pressed","title"],Rh={class:"mdi"},Hh=["aria-pressed"],Uh={class:"icon-list"},jh={class:"icon-grid"},Bh=["title","aria-label","aria-pressed","onClick"],Vh={class:"mdi"},Wh={key:0,class:"hint"},Kh={key:1},ja=Te({__name:"IconPicker",props:{selected:{},automatic:{},autoLabel:{},allowNone:{type:Boolean},note:{}},emits:["pick"],setup(e,{emit:t}){const n=e,s=t,o=de(""),l=k(()=>fs(n.selected)),a=k(()=>n.selected==="none"?"":ge(l.value?.cp||n.automatic)),r=k(()=>n.selected==="none"?"No icon":l.value?.label||n.autoLabel),c=k(()=>{const f=o.value.trim().toLocaleLowerCase();return(d.inventory.icons?.groups||[]).map(u=>({label:u.label,icons:u.icons.filter(h=>!f||`${h.label} ${h.name.replaceAll("-"," ")} ${u.label}`.toLocaleLowerCase().includes(f))})).filter(u=>u.icons.length)});return(f,u)=>(p(),v("div",Oh,[u[5]||(u[5]=i("span",{class:"f-label"},"Icon",-1)),i("button",{type:"button",class:"row","aria-expanded":y(d).iconPickerOpen?"true":"false",onClick:u[0]||(u[0]=h=>y(d).iconPickerOpen=!y(d).iconPickerOpen)},[i("span",Mh,m(a.value),1),i("span",Lh,[i("b",null,m(r.value),1)]),i("span",Dh,m(y(d).iconPickerOpen?"Close":"Change"),1)],8,Ih),y(d).iconPickerOpen?(p(),v("div",Fh,[ye(i("input",{"onUpdate:modelValue":u[1]||(u[1]=h=>o.value=h),type:"search",placeholder:"Search, for example lamp, music, or door","aria-label":"Search for an icon"},null,512),[[De,o.value]]),i("button",{type:"button",class:"icon-choice icon-auto","aria-pressed":e.selected==="auto"?"true":"false",title:e.autoLabel,onClick:u[2]||(u[2]=h=>s("pick","auto"))},[i("span",Rh,m(y(ge)(e.automatic)),1),i("span",null,m(e.autoLabel),1)],8,Nh),e.allowNone?(p(),v("button",{key:0,type:"button",class:"icon-choice icon-auto","aria-pressed":e.selected==="none"?"true":"false",title:"No icon",onClick:u[3]||(u[3]=h=>s("pick","none"))},[...u[4]||(u[4]=[i("span",{class:"mdi"},null,-1),i("span",null,"No icon, text only",-1)])],8,Hh)):j("",!0),i("div",Uh,[(p(!0),v(B,null,ie(c.value,h=>(p(),v("section",{key:h.label},[i("small",null,m(h.label),1),i("div",jh,[(p(!0),v(B,null,ie(h.icons,w=>(p(),v("button",{key:w.name,type:"button",class:"icon-choice",title:w.label,"aria-label":`Icon: ${w.label}`,"aria-pressed":e.selected===w.name?"true":"false",onClick:$=>s("pick",w.name)},[i("span",Vh,m(y(ge)(w.cp)),1)],8,Bh))),128))])]))),128)),c.value.length?j("",!0):(p(),v("p",Wh,"No icon found."))])])):j("",!0),e.note?(p(),v("small",Kh,m(e.note),1)):j("",!0)]))}}),qh={class:"dr-head"},Yh={class:"tx"},zh={class:"mono"},Jh={class:"dr-body"},Gh={class:"f"},Xh=["value","placeholder"],Zh={key:1,class:"f"},Qh={key:2,class:"f"},ev={key:0,class:"warn"},tv={class:"f"},nv={key:0},sv={key:3,class:"f"},ov={key:4,class:"f"},iv={key:6,class:"f"},lv={key:0,class:"warn"},av={key:7,class:"f"},rv={class:"f"},uv={class:"sw"},cv=["aria-label","aria-pressed","onClick"],dv={class:"dr-foot"},fv=Te({__name:"TileInspector",props:{tile:{}},setup(e){const t=e,n=k(()=>t.tile.entity.split(".")[0]),s=k(()=>ds(t.tile.entity)),o=k(()=>Xs(t.tile.entity)),l=Array.from({length:gn},(M,P)=>[P+1,String(P+1)]),a=k(()=>o.value?[["single","Normal"],["wide","Double-width"]]:[["single","Normal"],["wide","Double-width"],["full","Full page"]]),r=k(()=>o.value?"":Kt(0,2,62)?"Full page: one big button that lights up while on; a slider, controls or a graph sit at the bottom of it.":"A full-page tile needs firmware 0.2.62: press Update on the screen first."),c=k(()=>d.capabilities[t.tile.entity]),f=(M,P)=>t.tile.options?.[M]??P,u=k(()=>f("display",n.value==="screen"?"digital":"standard")),h=k(()=>{const M=n.value==="screen"?[["digital","Digital clock"],["analog","Analog clock"]]:[["standard","Name and status"],["watch","Large value"]],P=c.value;return n.value==="weather"&&(!P||P.displays.includes("forecast")||u.value==="forecast")&&M.push(["forecast","Weather forecast"]),n.value==="sensor"&&(!P||P.displays.includes("graph")||u.value==="graph")&&M.push(["graph","Graph"]),n.value==="sun"&&M.push(["sunpath","Sun path"]),M}),w=k(()=>{const M=c.value;return M&&u.value==="graph"&&!M.displays.includes("graph")?"Home Assistant has no numbers for this entity, so the graph stays empty. Choose another display.":M&&u.value==="forecast"&&!M.displays.includes("forecast")?"This weather service has no daily forecast in Home Assistant. Choose another display.":""}),$=k(()=>f("size","single")),D=k(()=>d.inventory.controls?.[n.value]),E=k(()=>f("controls",$.value==="full"?"none":D.value?.default)),x=k(()=>{const M=c.value;return(D.value?.choices||[]).filter(P=>!M||P.key==="none"||P.key===E.value||M.controls.includes(P.key)).map(P=>[P.key,P.label])}),S=k(()=>{const M=c.value;return M&&E.value!=="none"&&!M.controls.includes(E.value)?{text:"Home Assistant doesn't offer this control for this entity, so it stays empty on the screen. Choose another one.",warn:!0}:{text:Kt(0,2,19)?$.value==="full"?"At the bottom of the full-page tile; a tap anywhere else works as set below.":"On the right of the double-width tile, like the rows in Home Assistant. Tapping the name works as set below.":"The screen shows direct control from firmware 0.2.19; until then the tile stays as it was.",warn:!1}}),L=k(()=>f("tap","auto")),J=k(()=>{const M=[["auto","Automatic"],["detail","Open control"],["none","View only"]];return((c.value?c.value.toggle:Xi.includes(n.value))||L.value==="toggle")&&M.push(["toggle","On / off"]),M.push(["action","Perform action"]),M}),C=k(()=>L.value==="toggle"&&c.value&&!c.value.toggle?{text:"Home Assistant can't turn this on and off, so a tap does nothing. Choose another option.",warn:!0}:L.value==="toggle"&&!Xi.includes(n.value)&&!Kt(0,2,58)?{text:"The screen switches this from firmware 0.2.58: press Update on the screen. Until then a tap opens its card.",warn:!1}:L.value==="toggle"?{text:"Hold the tile to open its card.",warn:!1}:null),V=k(()=>f("inline","none")),I=k(()=>Lc.includes(n.value)&&(!c.value||c.value.inline||V.value==="slider")),A=k(()=>V.value==="slider"&&c.value&&!c.value.inline),b=k(()=>f("history_hours",24)),T=k(()=>Object.entries(d.inventory.backgrounds||{})),ne=k(()=>!!d.inventory.entities.find(M=>M.id===t.tile.entity)?.icon),Se=k(()=>!!d.inventory.icons&&(n.value!=="screen"||o.value>0)&&!["forecast","sunpath"].includes(u.value));function Oe(M){t.tile.name=M,Xe()}function G(){d.inspector={kind:"inspect",entity:t.tile.entity}}return(M,P)=>(p(),v(B,null,[i("div",qh,[i("span",{class:"av mdi",style:Ae({color:y(wt)(e.tile.entity)[2],background:y(wt)(e.tile.entity)[3]})},m(y(ge)(y(Un)(e.tile))),5),i("span",Yh,[i("b",null,m(e.tile.name||s.value),1),i("small",zh,m(e.tile.entity),1)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:P[0]||(P[0]=(...z)=>y(Be)&&y(Be)(...z))},"✕")]),i("div",Jh,[i("div",Gh,[P[11]||(P[11]=i("label",{class:"f-label",for:"tile-name"},"Name on the screen",-1)),i("input",{id:"tile-name",value:e.tile.name,placeholder:s.value,maxlength:"60",onInput:P[1]||(P[1]=z=>Oe(z.target.value))},null,40,Xh)]),Se.value?(p(),Je(ja,{key:0,selected:e.tile.options?.icon||"auto",automatic:y(en)(e.tile.entity),"auto-label":`Automatic (${ne.value?"from Home Assistant":"default"})`,note:y(Kt)(0,2,18)?"":"The screen shows a chosen icon from firmware 0.2.18.",onPick:P[2]||(P[2]=z=>y(Bt)(e.tile,"icon",z))},null,8,["selected","automatic","auto-label","note"])):j("",!0),o.value?(p(),v("div",Zh,[P[12]||(P[12]=i("span",{class:"f-label"},"Goes to page",-1)),we(it,{choices:y(l),value:o.value,onPick:P[3]||(P[3]=z=>y(Vc)(e.tile,Number(z)))},null,8,["choices","value"]),i("small",null,m(y(Kt)(0,2,62)?"A tap on the tile opens that page.":"Navigation tiles need firmware 0.2.62: press Update on the screen first."),1)])):(p(),v("div",Qh,[P[13]||(P[13]=i("span",{class:"f-label"},"Display",-1)),we(it,{choices:h.value,value:u.value,onPick:P[4]||(P[4]=z=>y(Bt)(e.tile,"display",z))},null,8,["choices","value"]),w.value?(p(),v("small",ev,m(w.value),1)):j("",!0)])),i("div",tv,[P[14]||(P[14]=i("span",{class:"f-label"},"Size",-1)),we(it,{choices:a.value,value:$.value,onPick:P[5]||(P[5]=z=>y(Bt)(e.tile,"size",z))},null,8,["choices","value"]),r.value?(p(),v("small",nv,m(r.value),1)):j("",!0)]),D.value&&$.value!=="single"&&!o.value?(p(),v("div",sv,[P[15]||(P[15]=i("span",{class:"f-label"},"Direct control on the tile",-1)),we(it,{choices:x.value,value:E.value,onPick:P[6]||(P[6]=z=>y(Bt)(e.tile,"controls",z))},null,8,["choices","value"]),i("small",{class:le({warn:S.value.warn})},m(S.value.text),3)])):j("",!0),n.value!=="screen"&&!o.value?(p(),v("div",ov,[P[16]||(P[16]=i("span",{class:"f-label"},"On tap",-1)),we(it,{choices:J.value,value:L.value,onPick:P[7]||(P[7]=z=>y(Bt)(e.tile,"tap",z))},null,8,["choices","value"]),C.value?(p(),v("small",{key:0,class:le({warn:C.value.warn})},m(C.value.text),3)):j("",!0)])):j("",!0),n.value!=="screen"&&!o.value&&L.value==="action"?(p(),Je(Ph,{key:5,tile:e.tile},null,8,["tile"])):j("",!0),I.value&&!o.value?(p(),v("div",iv,[P[17]||(P[17]=i("span",{class:"f-label"},"Small slider on the tile",-1)),we(it,{choices:[["none","No"],["slider","Yes, control directly"]],value:V.value,onPick:P[8]||(P[8]=z=>y(Bt)(e.tile,"inline",z))},null,8,["value"]),A.value?(p(),v("small",lv,"Home Assistant has nothing a slider can change for this entity. Choose No.")):j("",!0)])):j("",!0),n.value==="sensor"&&!o.value?(p(),v("div",av,[P[18]||(P[18]=i("span",{class:"f-label"},"History",-1)),we(it,{choices:[[1,"1 hour"],[6,"6 hours"],[24,"24 hours"]],value:b.value,onPick:P[9]||(P[9]=z=>y(Bt)(e.tile,"history_hours",Number(z)))},null,8,["value"])])):j("",!0),i("div",rv,[P[19]||(P[19]=i("span",{class:"f-label"},"Pastel background",-1)),i("div",uv,[(p(!0),v(B,null,ie(T.value,([z,oe])=>(p(),v("button",{key:z,type:"button","aria-label":`Background: ${oe.label}`,"aria-pressed":(e.tile.options?.background||"auto")===z?"true":"false",onClick:fe=>y(Bt)(e.tile,"background",z)},[i("i",{class:le(oe.color?"":z==="none"?"none":"auto"),style:Ae(oe.color?{background:oe.color}:void 0)},null,6),X(m(oe.label),1)],8,cv))),128))])])]),i("div",dv,[i("button",{type:"button",class:"btn danger",onClick:P[10]||(P[10]=z=>y(Ia)(e.tile))},"Remove"),P[20]||(P[20]=i("span",{class:"spacer"},null,-1)),n.value!=="screen"?(p(),v("button",{key:0,type:"button",class:"btn quiet",onClick:G},"Read current data")):j("",!0)])],64))}}),pv={class:"dr-head"},hv={class:"av mdi",style:{background:"var(--seg)",color:"var(--ink-2)"}},vv={class:"tx"},mv={class:"dr-body"},yv={class:"f"},gv=["value"],bv={class:"f"},wv={class:"f-label",id:"topbar-caption"},_v={style:{"text-transform":"none","letter-spacing":"0","font-weight":"500"}},kv={class:"items",id:"topbar-chips",role:"list","aria-labelledby":"topbar-caption"},$v=["data-index","aria-label","onPointerdown","onClick","onKeydown"],xv={class:"tx"},Sv=["aria-label","onClick"],Cv=["disabled","title"],Tv={class:"live",id:"topbar-live"},Av={class:"f"},Ev={class:"f"},Pv={key:1,class:"f"},Ov={key:2},Iv={key:0,class:"dr-foot"},Mv=["disabled"],Lv=["disabled"],Dv=Te({__name:"TopbarInspector",props:{index:{}},setup(e){const t=e,n=k(()=>Ht()),s=k(()=>n.value[t.index]),o=k(()=>(d.fontsVersion,d.now,d.topbarPreviews,ya(n.value,Ea.value,d.layout?.title||"Home",Vt))),l=k(()=>o.value.dropped),a=k(()=>d.inventory.header?.min_firmware||"0.2.32"),r=k(()=>{const[G,M,P]=a.value.split(".").map(Number);return Kt(G,M,P)}),c=k(()=>r.value?l.value.size?"Not everything fits next to the name: the screen drops the dashed items. Remove one or choose a shorter name.":"Drag to reorder; tap an item to configure it.":`Sensors, the date, and the analog clock appear from firmware ${a.value}; until that update, this screen shows the name and, if the time is in the bar, the clock.`),f=(G,M)=>{const P=Vt(G);return P.shown?l.value.has(M)?"Doesn't fit next to the name":P.analog?"Dial":P.text:"Hidden: not active right now"},u=G=>{const M=Vt(G);return M.analog||G.type!=="entity"?fs(ma[G.type])?.cp:M.icon},h=G=>d.topbarAdded?.key===Ke(G)&&Date.now()-d.topbarAdded.time<1200;function w(G){d.layout&&(d.layout.title=G,Xe())}function $(G){const M=[...n.value];M[t.index]={...M[t.index],...G},is(M)}const D=k(()=>s.value?Vt(s.value).shown?l.value.has(t.index)?"Doesn't currently fit next to the name":"How it looks on the screen":"Hidden right now: not active":""),E=k(()=>Pn().clock_24h!==!1),x=k(()=>({clock:li(E.value,new Date(d.now)),analog:"Small dial with the time",date:ai(new Date(d.now))})),S=de({index:-1,active:!1,moved:!1});let L=null,J=0,C=null,V=0;function I(G,M){G.button!==0||G.target.closest(".x")||(G.pointerType!=="touch"&&G.preventDefault(),S.value={index:M,active:!1,moved:!1},L={x:G.clientX,y:G.clientY},C=G.pointerId,clearTimeout(J),G.pointerType==="touch"&&(J=window.setTimeout(A,260)),document.addEventListener("pointermove",T),document.addEventListener("pointerup",ne),document.addEventListener("pointercancel",ne))}function A(){S.value.active=!0,document.addEventListener("touchmove",b,{passive:!1})}function b(G){S.value.active&&G.preventDefault()}function T(G){if(G.pointerId!==C||!L)return;if(!S.value.active){const z=Math.hypot(G.clientX-L.x,G.clientY-L.y);if(G.pointerType==="touch"){z>10&&(clearTimeout(J),L=null);return}if(z<6)return;A()}const M=[...document.querySelectorAll(".items .item[data-index]")];let P=S.value.index;if(M.forEach((z,oe)=>{const fe=z.getBoundingClientRect();oe<S.value.index&&G.clientY<fe.top+fe.height/2&&(P=Math.min(P,oe)),oe>S.value.index&&G.clientY>fe.top+fe.height/2&&(P=Math.max(P,oe))}),P!==S.value.index&&d.layout){const z=[...n.value];z.splice(P,0,...z.splice(S.value.index,1)),d.layout.header={items:z};const oe=t.index===S.value.index;S.value.index=P,S.value.moved=!0,oe&&Ot(P)}}function ne(G){G.pointerId===C&&(clearTimeout(J),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",ne),document.removeEventListener("pointercancel",ne),document.removeEventListener("touchmove",b),S.value.active&&(V=Date.now()+400,S.value.moved&&Xe()),S.value={index:-1,active:!1,moved:!1},L=null,C=null)}function Se(G){Date.now()<V||Ot(G)}function Oe(G,M){if(G.key==="Enter"||G.key===" "){G.preventDefault(),Ot(M);return}const P={ArrowUp:-1,ArrowDown:1}[G.key];P&&_o(M,M+P)&&(t.index===M&&Ot(M+P),G.preventDefault())}return(G,M)=>(p(),v(B,null,[i("div",pv,[i("span",hv,m(s.value?y(ge)(u(s.value)||"F0150"):y(ge)("F0150")),1),i("span",vv,[i("b",null,m(s.value?s.value.type==="entity"?y(ds)(s.value.entity):y(jn)(s.value):"Top bar"),1),i("small",{class:le({mono:s.value?.type==="entity"})},m(s.value?s.value.type==="entity"?s.value.entity:"From the screen itself, also works without Home Assistant":`${n.value.length} of ${y(qt)()} items`),3)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:M[0]||(M[0]=(...P)=>y(Be)&&y(Be)(...P))},"✕")]),i("div",mv,[i("div",yv,[M[10]||(M[10]=i("label",{class:"f-label",for:"title"},"Left: name",-1)),i("input",{id:"title",value:y(d).layout?.title,maxlength:"60",placeholder:"For example: Living room",onInput:M[1]||(M[1]=P=>w(P.target.value))},null,40,gv)]),i("div",bv,[i("span",wv,[M[11]||(M[11]=X("Right: time, sensors, or a clock ",-1)),i("span",_v," · "+m(n.value.length)+" / "+m(y(qt)()),1)]),i("div",kv,[(p(!0),v(B,null,ie(n.value,(P,z)=>(p(),v("div",{key:y(Ke)(P)+z,class:le(["item",{selected:z===e.index,"is-hidden":!y(Vt)(P).shown,"is-overflow":l.value.has(z),"just-added":h(P),"dragging-chip":S.value.active&&S.value.index===z}]),role:"listitem",tabindex:"0","data-index":z,"aria-label":`${y(jn)(P)}, slot ${z+1}. Enter: configure, arrows: move`,onPointerdown:oe=>I(oe,z),onClick:oe=>Se(z),onKeydown:oe=>Oe(oe,z)},[M[12]||(M[12]=i("span",{class:"grip","aria-hidden":"true"},"⋮⋮",-1)),i("span",{class:"av mdi",style:Ae(y(Vt)(P).color?{color:y(Vt)(P).color}:void 0)},m(u(P)?y(ge)(u(P)):""),5),i("span",xv,[i("b",null,m(y(jn)(P)),1),i("small",null,m(f(P,z)),1)]),i("button",{type:"button",class:"x","aria-label":`Remove ${y(jn)(P)} from the top bar`,onClick:ut(oe=>y(sl)(z),["stop"])},"✕",8,Sv)],42,$v))),128)),i("button",{type:"button",class:"ghost-btn",id:"topbar-add",disabled:n.value.length>=y(qt)(),title:n.value.length>=y(qt)()?`Maximum ${y(qt)()} items`:"Add the time, date, analog clock, or an entity",onClick:M[2]||(M[2]=(...P)=>y(el)&&y(el)(...P))},"+ Add time, date, or an entity",8,Cv)]),i("small",{id:"topbar-hint",class:le({warn:l.value.size>0&&r.value})},m(c.value),3)]),s.value?(p(),v(B,{key:0},[i("div",Tv,[i("small",null,m(D.value),1),we(Ua,{items:[s.value],single:""},null,8,["items"])]),s.value.type==="entity"?(p(),v(B,{key:0},[i("div",Av,[M[13]||(M[13]=i("span",{class:"f-label"},"What to show",-1)),we(it,{choices:(y(d).inventory.header?.contents||[]).map(P=>[P.key,P.label]),value:s.value.content,onPick:M[3]||(M[3]=P=>$({content:P}))},null,8,["choices","value"]),M[14]||(M[14]=i("small",null,"Last changed keeps counting on the screen itself: “Just now”, “5 min ago”, “Yesterday”.",-1))]),we(ja,{selected:s.value.icon||"auto",automatic:y(d).topbarPreviews[y(Ke)(s.value)]?.auto_icon||y(en)(s.value.entity),"auto-label":"Automatic (like Home Assistant)","allow-none":"",onPick:M[4]||(M[4]=P=>$({icon:P}))},null,8,["selected","automatic"]),i("div",Ev,[M[15]||(M[15]=i("span",{class:"f-label"},"Show",-1)),we(it,{choices:(y(d).inventory.header?.shows||[]).map(P=>[P.key,P.label]),value:s.value.show,onPick:M[5]||(M[5]=P=>$({show:P}))},null,8,["choices","value"]),M[16]||(M[16]=i("small",null,"Only when active hides the item as long as it's off, closed, away, or 0. Handy for an open door, a running washing machine, or who's home.",-1))])],64)):s.value.type!=="date"?(p(),v("div",Pv,[M[17]||(M[17]=i("span",{class:"f-label"},"Format",-1)),we(it,{choices:[["24","24 hour"],["12","12 hour"]],value:E.value?"24":"12",onPick:M[6]||(M[6]=P=>y(Bn)("clock_24h",P==="24",150))},null,8,["value"]),M[18]||(M[18]=i("small",null,"The screen's own clock setting: it applies at once to every clock on this screen, including the clock tiles.",-1))])):(p(),v("small",Ov,m(x.value.date)+" today. The date follows the screen's own clock.",1))],64)):j("",!0)]),s.value?(p(),v("div",Iv,[i("button",{type:"button",class:"btn danger",onClick:M[7]||(M[7]=P=>y(sl)(e.index))},"Remove"),M[19]||(M[19]=i("span",{class:"spacer"},null,-1)),i("button",{type:"button",class:"btn quiet",disabled:e.index===0,onClick:M[8]||(M[8]=P=>y(_o)(e.index,e.index-1)&&y(Ot)(e.index-1))},"↑ Up",8,Mv),i("button",{type:"button",class:"btn quiet",disabled:e.index>=n.value.length-1,onClick:M[9]||(M[9]=P=>y(_o)(e.index,e.index+1)&&y(Ot)(e.index+1))},"↓ Down",8,Lv)])):j("",!0)],64))}}),Fv={class:"dr-head"},Nv={class:"tx"},Rv={class:"dr-body"},Hv={class:"f"},Uv={class:"options"},jv=["disabled","onClick"],Bv={class:"mdi"},Vv={class:"tx"},Wv={key:0,class:"f"},Kv={class:"options"},qv=["disabled","onClick"],Yv={class:"mdi"},zv={class:"tx"},Jv={class:"f"},Gv={class:"options"},Xv=["disabled","onClick"],Zv={class:"mdi"},Qv={class:"tx"},em={key:0,class:"hint"},tm={key:1,class:"hint"},nm={class:"dr-foot"},sm=Te({__name:"TopbarAdd",setup(e){const t=de(""),n=k(()=>new Set(Ht().map(Ke))),s=k(()=>Pn().clock_24h!==!1),o=k(()=>({clock:li(s.value,new Date(d.now)),analog:"Small dial with the time",date:ai(new Date(d.now))})),l=k(()=>d.inventory.header?.suggestions?.[d.selected||""]||[]),a=k(()=>{const c=t.value.trim().toLocaleLowerCase();return d.inventory.entities.filter(f=>`${f.name} ${f.id} ${f.area||""} ${f.device||""}`.toLocaleLowerCase().includes(c))}),r=c=>({type:"entity",entity:c,content:"state",icon:"auto",show:"always"});return(c,f)=>(p(),v(B,null,[i("div",Fv,[f[4]||(f[4]=i("span",{class:"av",style:{background:"var(--seg)",color:"var(--ink-2)","font-size":"18px"}},"+",-1)),i("span",Nv,[f[3]||(f[3]=i("b",null,"Add to the top bar",-1)),i("small",null,m(y(Ht)().length)+" of "+m(y(qt)())+" slots used",1)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:f[0]||(f[0]=(...u)=>y(Be)&&y(Be)(...u))},"✕")]),i("div",Rv,[i("div",Hv,[f[5]||(f[5]=i("span",{class:"f-label"},"From the screen itself",-1)),i("div",Uv,[(p(!0),v(B,null,ie(y(d).inventory.header?.builtin||[],u=>(p(),v("button",{key:u.type,type:"button",class:"option",disabled:n.value.has(y(Ke)({type:u.type})),onClick:h=>y(ko)({type:u.type})},[i("span",Bv,m(y(ge)(y(fs)(y(ma)[u.type])?.cp||"F0150")),1),i("span",Vv,[i("strong",null,m(u.label),1),i("small",null,m(n.value.has(y(Ke)({type:u.type}))?"Already added":o.value[u.type]),1)])],8,jv))),128))])]),l.value.length?(p(),v("div",Wv,[f[6]||(f[6]=i("span",{class:"f-label"},"Suggestions from Home Assistant",-1)),i("div",Kv,[(p(!0),v(B,null,ie(l.value,u=>(p(),v("button",{key:y(Ke)(u.item),type:"button",class:"option",disabled:n.value.has(y(Ke)(u.item)),onClick:h=>y(ko)(u.item)},[i("span",Yv,m(y(ge)(u.icon||y(en)(u.item.entity))),1),i("span",zv,[i("strong",null,m(u.label),1),i("small",null,m(n.value.has(y(Ke)(u.item))?"Already added":[u.name,u.area].filter(Boolean).join(" · ")),1)])],8,qv))),128))])])):j("",!0),i("div",Jv,[f[7]||(f[7]=i("label",{class:"f-label",for:"topbar-search"},"An entity",-1)),ye(i("input",{id:"topbar-search","onUpdate:modelValue":f[1]||(f[1]=u=>t.value=u),type:"search",placeholder:"Search by name, room, or entity, e.g. temperature or door","aria-label":"Search for an entity for the top bar"},null,512),[[De,t.value]]),i("div",Gv,[(p(!0),v(B,null,ie(a.value.slice(0,40),u=>(p(),v("button",{key:u.id,type:"button",class:"option",disabled:n.value.has(y(Ke)(r(u.id))),onClick:h=>y(ko)(r(u.id))},[i("span",Zv,m(y(ge)(y(en)(u.id))),1),i("span",Qv,[i("strong",null,m(u.name),1),i("small",null,m([u.area,u.id].filter(Boolean).join(" · ")),1)])],8,Xv))),128)),a.value.length?a.value.length>40?(p(),v("p",tm,m(a.value.length)+" results. Keep typing to narrow it down.",1)):j("",!0):(p(),v("p",em,"No entities found."))])])]),i("div",nm,[f[8]||(f[8]=i("span",{class:"spacer"},null,-1)),i("button",{type:"button",class:"btn quiet",onClick:f[2]||(f[2]=(...u)=>y(Be)&&y(Be)(...u))},"Cancel")])],64))}}),om={class:"dr-head"},im={class:"tx"},lm={class:"dr-body",id:"inspector-section"},am={id:"inspection-summary"},rm={key:0,class:"hint warn"},um={key:1,class:"hint"},cm={id:"inspection"},dm=Te({__name:"InspectPanel",props:{entity:{}},setup(e){const t=e,n=de(null),s=de("Reading…"),o=de("");async function l(){if(d.selected){n.value=null,o.value="",s.value="Fetching current HA status...";try{const r=await ht(`screens/${encodeURIComponent(d.selected)}/inspect`),c=t.entity?r.tiles.filter(f=>f.entity===t.entity):r.tiles;n.value=c,s.value=JSON.stringify(t.entity?c[0]:r,null,2)}catch(r){o.value=r.message,s.value="",ke(r.message)}}}const a=r=>{const c=d.layout?.tiles.find(f=>f.entity===r)?.options||{};return`Small slider: ${c.inline==="slider"?"yes":"no"} · Display: ${Ta[c.display||"standard"]||c.display} · Size: ${Mc[c.size]||"normal"} · Control: ${Ec({entity:r,options:c},d.inventory)} · Background: ${d.inventory.backgrounds?.[c.background||"auto"]?.label||"Default"}`};return wn(l),dn(()=>t.entity,l),(r,c)=>(p(),v(B,null,[i("div",om,[c[2]||(c[2]=i("span",{class:"av",style:{background:"var(--seg)",color:"var(--ink-2)","font-size":"16px"}},"⌕",-1)),i("span",im,[c[1]||(c[1]=i("b",null,"Current data",-1)),i("small",{class:le({mono:e.entity})},m(e.entity||"Connection, status, and supported properties"),3)]),i("button",{type:"button",class:"icon-btn","aria-label":"Close",onClick:c[0]||(c[0]=(...f)=>y(Be)&&y(Be)(...f))},"✕")]),i("div",lm,[i("div",am,[o.value?(p(),v("p",rm,m(o.value),1)):n.value?j("",!0):(p(),v("p",um,"Fetching current HA status...")),(p(!0),v(B,null,ie(n.value||[],f=>(p(),v("article",{key:f.entity,class:"inspection-tile"},[i("strong",null,m(f.entity),1),i("span",null,"Status: "+m(f.word||f.state),1),i("small",null,m(a(f.entity)),1)]))),128))]),i("pre",cm,m(s.value),1)]),i("div",{class:"dr-foot"},[i("button",{type:"button",class:"btn quiet",onClick:l},"Read again"),c[3]||(c[3]=i("span",{class:"spacer"},null,-1))])],64))}}),fm=["aria-hidden"],pm=Te({__name:"Drawer",setup(e){const t=k(()=>!!(d.inspector&&(d.inspector.kind!=="tile"||vo.value)));return(n,s)=>(p(),v("aside",{class:le(["drawer",{open:t.value}]),id:"tile-sheet","aria-hidden":t.value?"false":"true",onClick:s[0]||(s[0]=ut(()=>{},["stop"]))},[y(d).inspector?(p(),v(B,{key:0},[y(d).inspector.kind==="tile"&&y(vo)?(p(),Je(fv,{key:0,tile:y(vo)},null,8,["tile"])):y(d).inspector.kind==="bar"?(p(),Je(Dv,{key:1,index:y(d).inspector.index},null,8,["index"])):y(d).inspector.kind==="bar-add"?(p(),Je(sm,{key:2})):y(d).inspector.kind==="inspect"?(p(),Je(dm,{key:3,entity:y(d).inspector.entity},null,8,["entity"])):j("",!0)],64)):j("",!0)],10,fm))}}),hm={class:"main-head"},vm={class:"eyebrow",id:"screen-name"},mm=["title"],ym={class:"head-right"},gm={class:"seg",role:"tablist"},bm=["aria-pressed"],wm=["aria-pressed"],_m={key:1,id:"dirty",class:"chip dirty"},km=["disabled"],$m={key:0,class:"spin small"},xm=["aria-expanded"],Sm={key:3,class:"menu",role:"menu"},Cm=["disabled","title"],Tm=["disabled","aria-expanded"],Am={key:0,class:"sub"},Em=["onClick"],Pm=["disabled","title"],Om={class:"body",id:"body"},Im=Te({__name:"ScreenView",setup(e){const t=k(()=>Tt.value),n=k(()=>t.value.online?`${t.value.delivery} · ${t.value.status}`:"Offline · changes are saved"),s=k(()=>t.value.update?.available&&t.value.online&&t.value.update?.profile&&t.value.update?.host),o=k(()=>d.inventory.screens.filter(E=>E.id!==t.value.id&&E.layout?.tiles?.length)),l=de(!1),a=de(null);function r(){d.menuOpen=!1,l.value=!1}function c(){r(),d.overrideProfile=t.value.update?.profile||null,d.overrideFriendly=t.value.name,Ee("#override")}function f(){r(),d.selectedTile=null,d.inspector={kind:"inspect"}}function u(E){r(),!(d.dirty&&!confirm("Replace the unsaved layout with a copy of the other screen's?"))&&qc(E)}function h(){r(),a.value?.click()}async function w(E){const x=E.target,S=x.files?.[0];x.value="",S&&(d.dirty&&!confirm("Replace the unsaved layout with the imported one?")||zc(await S.text()))}function $(E){if(E.key==="Escape")if(d.menuOpen)r();else{if(d.palette)return;d.inspector&&!E.target?.closest?.(".picker")&&Be()}else(E.metaKey||E.ctrlKey)&&E.key.toLowerCase()==="s"&&(E.preventDefault(),d.dirty&&Ro())}function D(E){d.menuOpen&&!E.target.closest(".head-right .menu, #more")&&r()}return wn(()=>{document.addEventListener("keydown",$),document.addEventListener("click",D)}),On(()=>{document.removeEventListener("keydown",$),document.removeEventListener("click",D)}),(E,x)=>(p(),v(B,null,[i("header",hm,[i("div",null,[i("span",vm,m(t.value.name),1),i("h1",null,m(y(d).layout?.title||"Home"),1)]),i("span",{id:"delivery",class:le(["chip",{off:!t.value.online}]),title:n.value},[x[9]||(x[9]=i("span",{class:"dot"},null,-1)),X(m(n.value),1)],10,mm),i("div",ym,[i("div",gm,[i("button",{type:"button",id:"tab-layout",role:"tab","aria-pressed":y(d).tab==="layout"?"true":"false",onClick:x[0]||(x[0]=S=>y(d).tab="layout")},"Layout",8,bm),i("button",{type:"button",id:"tab-settings",role:"tab","aria-pressed":y(d).tab==="settings"?"true":"false",onClick:x[1]||(x[1]=S=>{y(d).tab="settings",y(Be)()})},"Screen settings",8,wm)]),y(d).dirty?(p(),v("span",_m,"Unsaved changes")):(p(),v("span",{key:0,id:"dirty",class:le(["chip",{sent:y(d).saved}])},m(y(d).saved?"Saved · sent to screen":"All saved"),3)),y(d).dirty?(p(),v("button",{key:2,id:"save",type:"button",class:"btn primary",disabled:y(d).busy,title:"⌘S",onClick:x[2]||(x[2]=S=>y(Ro)())},[y(d).busy?(p(),v("span",$m)):j("",!0),X(m(y(d).busy?"Saving…":"Save & send"),1)],8,km)):j("",!0),i("button",{id:"more",type:"button",class:"icon-btn","aria-label":"More","aria-haspopup":"menu","aria-expanded":y(d).menuOpen?"true":"false",onClick:x[3]||(x[3]=ut(S=>{y(d).menuOpen=!y(d).menuOpen,l.value=!1},["stop"]))},"···",8,xm),y(d).menuOpen?(p(),v("div",Sm,[i("button",{type:"button",role:"menuitem",id:"identify",disabled:!y(mn)(t.value)||!t.value.online,title:y(mn)(t.value)?"":"Needs firmware 0.2.31 or newer",onClick:x[4]||(x[4]=S=>{r(),y(Ma)(t.value)})},[...x[10]||(x[10]=[X("Identify ",-1),i("small",null,"blink the screen",-1)])],8,Cm),i("button",{type:"button",role:"menuitem",id:"inspect",onClick:f},[...x[11]||(x[11]=[X("Read current data ",-1),i("small",null,"from Home Assistant",-1)])]),x[17]||(x[17]=i("div",{class:"sep"},null,-1)),i("button",{type:"button",role:"menuitem",id:"copy-layout",disabled:!o.value.length,"aria-expanded":l.value?"true":"false",onClick:x[5]||(x[5]=ut(S=>l.value=!l.value,["stop"]))},[x[12]||(x[12]=X("Copy layout from… ",-1)),i("small",null,m(o.value.length?`${o.value.length} screen${o.value.length===1?"":"s"}`:"no other screen"),1)],8,Tm),l.value?(p(),v("div",Am,[(p(!0),v(B,null,ie(o.value,S=>(p(),v("button",{key:S.id,type:"button",role:"menuitem",onClick:L=>u(S.id)},[X(m(S.name)+" ",1),i("small",null,m(S.layout.tiles.length)+" tiles",1)],8,Em))),128))])):j("",!0),i("button",{type:"button",role:"menuitem",id:"export-layout",onClick:x[6]||(x[6]=S=>{r(),y(Da)()})},[...x[13]||(x[13]=[X("Export layout ",-1),i("small",null,"JSON",-1)])]),i("button",{type:"button",role:"menuitem",id:"import-layout",onClick:h},[...x[14]||(x[14]=[X("Import layout… ",-1),i("small",null,"JSON",-1)])]),x[18]||(x[18]=i("div",{class:"sep"},null,-1)),i("button",{type:"button",role:"menuitem",id:"open-override",disabled:!t.value.update?.profile,title:t.value.update?.profile?"":"No ESPHome profile found for this screen",onClick:c},[...x[15]||(x[15]=[X("Override YAML ",-1),i("small",null,"advanced",-1)])],8,Pm),i("button",{type:"button",role:"menuitem",onClick:x[7]||(x[7]=S=>{r(),y(Ee)("#firmware")})},"Firmware & USB"),s.value?(p(),v("button",{key:1,type:"button",role:"menuitem",onClick:x[8]||(x[8]=S=>{r(),y(Uo)(t.value)})},[x[16]||(x[16]=X("Update firmware ",-1)),i("small",null,m(t.value.update?.target),1)])):j("",!0)])):j("",!0),i("input",{ref_key:"fileInput",ref:a,type:"file",accept:"application/json,.json",hidden:"",onChange:w},null,544)])]),i("div",Om,[y(d).tab==="layout"?(p(),Je(Up,{key:0})):(p(),Je(nh,{key:1})),we(pm)])],64))}}),Mm={key:0,id:"choose",class:"empty"},Lm={key:1,id:"empty",class:"empty"},Dm=Te({__name:"EmptyState",setup(e){return(t,n)=>y(d).inventory.screens.length?(p(),v("section",Mm,[...n[1]||(n[1]=[i("span",{class:"empty-icon"},"▦",-1),i("h2",null,"Choose a screen",-1),i("p",null,"Pick one of your screens on the left to change its tiles, top bar and settings.",-1)])])):(p(),v("section",Lm,[n[2]||(n[2]=i("span",{class:"empty-icon"},"▦",-1)),n[3]||(n[3]=i("h2",null,"Start with a screen",-1)),n[4]||(n[4]=i("p",null,"Connect a CYD or Guition via USB to your Home Assistant machine. Profile, firmware, and the first flash happen in one go.",-1)),i("button",{id:"start",type:"button",class:"btn primary",onClick:n[0]||(n[0]=s=>y(Ee)("#new-screen"))},"Install new screen")]))}}),Fm={class:"panel",id:"settings-view"},Nm={class:"panel-head"},Rm={class:"card-grid"},Hm={class:"card"},Um={class:"tools"},jm={key:0,class:"card updates",id:"updates"},Bm={id:"updates-hint"},Vm=["aria-valuenow"],Wm={class:"progress-text"},Km={key:0,class:"log-lines"},qm={key:2,class:"whatsnew"},Ym={class:"check"},zm=["checked"],Jm={class:"card"},Gm={class:"tools"},Xm={class:"card",id:"claude"},Zm={class:"actions"},Qm=["disabled"],ey={id:"claude-path"},ty=Te({__name:"AppSettingsView",setup(e){const t=k(()=>d.inventory.updates),n=k(()=>d.inventory.screens.filter(h=>h.update?.available).length),s=k(()=>t.value?t.value.busy?`Updating to firmware ${t.value.target}…`:d.inventory.screens.length?n.value?`Firmware ${t.value.target} is available for ${n.value} screen${n.value===1?"":"s"}.`:`All screens have firmware ${t.value.target}.`:`No screen paired yet. New screens get firmware ${t.value.target}.`:""),o=k(()=>d.inventory.screens.find(h=>h.update?.state==="running"||d.updating.includes(h.id))),l=k(()=>o.value?$n(o.value):null),a=k(()=>(d.firmwareJob?.logs||[]).slice(-12).join(`
`)),r=k(()=>{const h=t.value?.changelog,w=t.value?.target;return!h||!w?[]:h.filter($=>$.firmware===w).flatMap($=>$.lines).slice(0,10)}),c=k(()=>d.inventory.claude_skill),f=de(!1);async function u(){f.value=!0;try{await nd()}finally{f.value=!1}}return(h,w)=>(p(),v("div",Fm,[i("div",Nm,[w[6]||(w[6]=i("div",{class:"tx"},[i("span",{class:"eyebrow"},"Settings"),i("h1",{id:"settings-title"},"Everything around your screens.")],-1)),i("button",{type:"button",class:"btn quiet",id:"close-settings",onClick:w[0]||(w[0]=$=>y(Ee)(""))},"← My screens")]),i("div",Rm,[i("section",Hm,[w[9]||(w[9]=i("h2",null,"Screens",-1)),w[10]||(w[10]=i("p",null,"Add a screen, or build and reinstall the firmware of one you already have.",-1)),i("div",Um,[i("button",{type:"button",class:"tool",onClick:w[1]||(w[1]=$=>y(Ee)("#new-screen"))},[...w[7]||(w[7]=[i("span",{class:"tool-icon"},"+",-1),i("span",{class:"tx"},[i("b",null,"New screen"),i("small",null,"Connect and install")],-1)])]),i("button",{type:"button",class:"tool",onClick:w[2]||(w[2]=$=>y(Ee)("#firmware"))},[...w[8]||(w[8]=[i("span",{class:"tool-icon"},"⇪",-1),i("span",{class:"tx"},[i("b",null,"Firmware & USB"),i("small",null,"Build and install via USB or Wi-Fi")],-1)])])])]),t.value?(p(),v("section",jm,[w[12]||(w[12]=i("h2",null,"Firmware updates",-1)),i("p",Bm,m(s.value),1),o.value&&l.value?(p(),v(B,{key:0},[i("div",{class:"progress",role:"progressbar","aria-valuenow":l.value.percent,"aria-valuemin":"0","aria-valuemax":"100"},[i("i",{style:Ae({width:l.value.percent+"%"})},null,4)],8,Vm),i("div",Wm,[i("span",null,m(o.value.name)+" · "+m(l.value.percent)+" %",1),i("span",null,m(l.value.text),1)]),a.value?(p(),v("pre",Km,m(a.value),1)):j("",!0)],64)):j("",!0),t.value.pending&&!t.value.busy&&t.value.pending>=2?(p(),v("button",{key:1,id:"update-all",type:"button",class:"btn primary",onClick:w[3]||(w[3]=(...$)=>y(il)&&y(il)(...$))},"Update all "+m(t.value.pending)+" screens",1)):j("",!0),r.value.length&&!y(Ho)()?(p(),v("details",qm,[i("summary",null,"What's new in firmware "+m(t.value.target),1),i("ul",null,[(p(!0),v(B,null,ie(r.value,$=>(p(),v("li",{key:$},m($),1))),128))])])):j("",!0),i("label",Ym,[i("input",{type:"checkbox",id:"auto-update",checked:!!t.value.auto,onChange:w[4]||(w[4]=$=>y(td)($.target.checked))},null,40,zm),w[11]||(w[11]=i("span",null,[X("Update automatically every night"),i("small",null,"Between 03:00 and 06:00, one screen at a time. Stops on an error and reports it in Home Assistant.")],-1))])])):j("",!0),i("section",Jm,[w[14]||(w[14]=i("h2",null,"Alerts",-1)),w[15]||(w[15]=i("p",null,"A card over the whole screen from an automation, on one screen or on all of them. The cheatsheet has the action names, fields, icons, and colors, and a form to try one.",-1)),i("div",Gm,[i("button",{type:"button",class:"tool",onClick:w[5]||(w[5]=$=>y(Ee)("#alerts"))},[...w[13]||(w[13]=[i("span",{class:"tool-icon"},"!",-1),i("span",{class:"tx"},[i("b",null,"Alerts"),i("small",null,"Full-screen notifications, from an automation")],-1)])])])]),i("section",Xm,[w[18]||(w[18]=i("h2",null,"Claude",-1)),w[19]||(w[19]=i("p",null,'Teach Claude about ESP Screens, then ask: "Show an alert on all my screens when the mailbox is full." Claude knows the alert events, every field, color, and icon.',-1)),i("div",Zm,[i("button",{type:"button",id:"claude-install",class:le(["btn",c.value?.installed&&c.value.current?"quiet":"primary"]),disabled:!c.value||f.value,onClick:u},m(!c.value||!c.value.installed?"Install for Claude Code":c.value.current?"Install again":"Update the skill"),11,Qm),i("span",{id:"claude-status",class:le(["chip",c.value&&c.value.installed?c.value.current?"good":"update":""]),role:"status"},m(c.value?c.value.installed?c.value.current?"● Installed":"Installed · a newer version is ready":"Not installed":"Loading…"),3)]),i("small",null,[w[16]||(w[16]=X("For Claude Code in Home Assistant. Writes one file to ",-1)),i("code",ey,m(c.value?.path||"/homeassistant/.claude/skills/esp-screens"),1),w[17]||(w[17]=X("; installing again replaces it.",-1))]),w[20]||(w[20]=i("div",{class:"actions"},[i("a",{class:"btn quiet",id:"claude-download",href:"api/claude-skill.zip",download:"esp-screens.zip"},"Download for claude.ai"),i("small",null,"Upload the zip in Claude under Customize → Skills.")],-1))])])]))}}),ny={class:"panel",id:"installer"},sy={class:"panel-head"},oy={class:"tx"},iy={id:"install-title"},ly={key:0},ay={class:"boards"},ry={class:"board"},uy={class:"board"},cy={class:"field"},dy={class:"node-line"},fy={id:"node-preview"},py={key:0,class:"field",id:"node-label"},hy={key:1,id:"wifi-fields",class:"wifi"},vy={class:"hint",id:"wifi-status"},my={key:0,class:"field",id:"wifi-ssid-label"},yy={key:1,class:"field",id:"wifi-password-label"},gy={class:"field"},by={key:0,value:"usb"},wy=["value"],_y={id:"target-hint"},ky={key:2,class:"hint",id:"install-note"},$y={class:"actions"},xy=["disabled"],Sy={id:"install-status",class:"status-line error",role:"status"},Cy={key:1,id:"install-progress",class:"card"},Ty={class:"progress-head"},Ay={key:0,class:"spin",id:"progress-spin"},Ey={id:"progress-title"},Py={id:"progress-detail"},Oy={key:0,id:"install-download",class:"card",style:{background:"var(--surface-2)"}},Iy=["href","download"],My={class:"steps",id:"download-steps"},Ly={key:1,id:"install-result",class:"field"},Dy={class:"key-box"},Fy={class:"steps",id:"install-steps"},Ny=["open"],Ry={id:"install-log",class:"log"},Hy={class:"actions"},Uy="https://web.esphome.io/?dashboard_install",jy="Download · flash from your own computer",By=Te({__name:"InstallerView",setup(e){const t=yn({board:"cyd",friendly_name:"",name:"",wifi_ssid:"",wifi_password:"",target:""}),n=yn({view:"setup",file:null,friendly:"",board:"cyd",target:"",apiKey:null,nodeEdited:!1,jobState:null,picked:!1,action:null}),s=de(!1),o=de(null),l=de(null),a=de([]),r=de(""),c=de(""),f=de(!1),u=de(!1),h=de(null);let w=0;function $(pe){return pe.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^[^a-z]+/,"").slice(0,30).replace(/-+$/,"")||"screen"}function D(pe){const H=pe.replace(/^\/dev\/serial\/by-id\/usb-/,"").replace(/-if\d+(-port\d+)?$/,"").replace(/_/g," ");return`USB · ${H===pe?pe.replace(/^\/dev\//,""):H}`}dn(()=>t.friendly_name,()=>{n.nodeEdited||(t.name=$(t.friendly_name))});const E=k(()=>t.name||"…"),x=k(()=>o.value?.ports||[]),S=k(()=>o.value?.wifi),L=k(()=>S.value?.state==="new"||S.value?.state==="missing"),J=k(()=>S.value?.missing||[]),C=k(()=>S.value?.state==="new"?"Fill in once: ESP Screens saves this in ESPHome secrets.yaml, later screens use it automatically.":"Your ESPHome secrets.yaml is still missing Wi-Fi details. ESP Screens only fills in the missing lines."),V=k(()=>S.value?.state==="ready"?"Wi-Fi comes from your ESPHome secrets.yaml.":S.value?.state==="invalid"?"secrets.yaml in the ESPHome folder isn't valid YAML. Fix the file first; it won't be overwritten.":""),I=k(()=>t.target==="usb"?"Connect the screen with a USB data cable to the Home Assistant machine; the list refreshes on its own. Or choose Download to use your own computer.":t.target==="download"?"Download the firmware and put it on the screen from your own computer, in Chrome or Edge. After that, updates go over Wi-Fi.":t.target?x.value.length>1?"More than one board connected: choose this screen's port.":"Once over USB; after that, everything is wireless.":"The profile goes into the ESPHome folder. You can install later via Firmware & USB, or from ESPHome Device Builder."),A=k(()=>t.target==="download"?"Build & download":t.target?"Install":"Save profile"),b=k(()=>o.value?.job?.state==="running"&&!(n.file&&o.value.job.file===n.file)),T=k(()=>f.value||S.value?.state==="invalid"||t.target==="usb"||!!t.target&&(b.value||!o.value?.available));function ne(){const pe=t.target;(pe==="download"||pe===""?n.picked:x.value.includes(pe))||(t.target=x.value[0]||"usb")}async function Se(){let pe;try{pe=await ht("firmware")}catch(ot){r.value=ot.message;return}o.value=pe;const H=pe.job,ce=H&&n.file&&H.file===n.file;if(ce&&(n.jobState=H.state),n.view==="setup"){if(ce&&H.state==="running"){Oe(H,pe.logs||[]);return}ne(),r.value=b.value?`A build or installation is already running (${H.file}). Wait for it to finish.`:!pe.available&&t.target?"The ESPHome CLI is missing from this installation; only saving the profile is possible.":V.value}else n.view==="progress"&&ce&&(l.value=H,a.value=pe.logs||[],H.state!=="running"&&H.state!=="success"&&(u.value=!0))}function Oe(pe,H){n.view="progress",n.jobState=pe.state,n.action=pe.action,l.value=pe,a.value=H}const G=k(()=>l.value?.state==="running"),M=k(()=>n.view==="done"||l.value?.state==="success"),P=k(()=>n.action==="download"),z=k(()=>n.view==="done"?"Profile saved.":G.value?"One moment…":M.value?P.value?"Ready to download.":"Done.":"That didn't work."),oe=k(()=>n.view==="done"?`${n.file} is in the ESPHome folder`:G.value?l.value?.stage==="upload"?`Writing firmware to ${n.friendly}…`:"Building firmware…":M.value?P.value?`Firmware for ${n.friendly} is ready`:`Firmware is on ${n.friendly}`:P.value?"Build failed":"Install failed"),fe=k(()=>n.view==="done"?"Install it later from Firmware & USB: choose this profile, then the USB port of the Home Assistant machine, or Download to put the firmware on the screen from your own computer. Save the API key for pairing:":G.value?l.value?.stage==="upload"?"Don't disconnect the USB cable yet.":`A first build takes a few minutes on a Raspberry Pi. You can leave this page: the ${P.value?"build":"installation"} keeps running and you'll find it again under New screen.`:M.value?P.value?"Put it on the screen from your own computer, then pair the screen with Home Assistant.":`The screen boots up and connects to your Wi-Fi.${n.board==="cyd"?" The CYD first asks for a touch calibration: tap the crosshairs.":""} Pair it with Home Assistant now:`:a.value.filter(pe=>/error/i.test(pe)).pop()||a.value.filter(pe=>/failed/i.test(pe)).pop()||"See the log below."),Z=k(()=>({href:`api/firmware/profiles/${encodeURIComponent(n.file||"")}/download`,name:(n.file||"").replace(/\.yaml$/,"")+".factory.bin"})),ue=k(()=>[["Go to Home Assistant → Settings → Devices & services.",` This happens outside ESP Screens. Home Assistant discovers ${n.friendly} as an ESPHome device; click Add. Not discovered? Add ESPHome manually with the screen's IP address. `],["Paste the API key"," above when Home Assistant asks for an encryption key."],["Allow HA actions:"," ESPHome integration → Configure → “Allow the device to perform Home Assistant actions”. Without this, the screen sees everything but controls nothing."],["Choose your tiles."," Back in ESP Screens, the screen appears in the list on the left within about thirty seconds; until then it's shown there as “not yet in Home Assistant”."]]);async function Me(pe){const H=pe.target;if(n.nodeEdited||(t.name=$(t.friendly_name)),!!H.reportValidity()){f.value=!0,c.value="";try{const ce={board:t.board,friendly_name:t.friendly_name,name:t.name,target:t.target};L.value&&(J.value.includes("wifi_ssid")&&(ce.wifi_ssid=t.wifi_ssid),J.value.includes("wifi_password")&&(ce.wifi_password=t.wifi_password));const ot=await st("firmware/profiles","POST",ce);Object.assign(n,{file:ot.file,apiKey:ot.api_key,friendly:t.friendly_name.trim(),board:t.board,target:t.target}),t.wifi_password="",ot.job?Oe(ot.job,[]):n.view="done"}catch(ce){c.value=ce.message}finally{f.value=!1}}}async function Fe(){try{if(!P.value){const{ports:H}=await ht("firmware");!H.includes(n.target)&&H.length===1&&(n.target=H[0])}const pe=await st("firmware/jobs","POST",P.value?{file:n.file,action:"download"}:{file:n.file,action:"install",target:n.target});Oe(pe,[])}catch(pe){ke(pe.message)}}function nn(){Object.assign(n,{view:"setup",file:null,apiKey:null,nodeEdited:!1,jobState:null,target:"",picked:!1,action:null}),Object.assign(t,{board:"cyd",friendly_name:"",name:"",wifi_ssid:"",wifi_password:"",target:""}),s.value=!1,l.value=null,a.value=[],c.value="",r.value="",u.value=!1,Se()}function ps(){n.view==="progress"&&n.jobState!=="running"&&(n.view="done"),Ee("")}return wn(()=>{Se(),w=window.setInterval(Se,3e3)}),On(()=>clearInterval(w)),(pe,H)=>(p(),v("div",ny,[i("div",sy,[i("div",oy,[H[13]||(H[13]=i("span",{class:"eyebrow"},"New screen",-1)),i("h1",iy,m(n.view==="setup"?"Connect and install.":z.value),1),n.view==="setup"?(p(),v("p",ly,"ESP Screens creates the screen's own profile with unique keys and builds the firmware. Connect the screen with a USB data cable to the machine running Home Assistant, or download the firmware and put it on the screen from your own computer.")):j("",!0)]),i("button",{type:"button",class:"btn quiet",id:"close-install","aria-label":"Close",onClick:ps},"← Back")]),n.view==="setup"?(p(),v("form",{key:0,id:"install-form",class:"card",onSubmit:ut(Me,["prevent"])},[i("fieldset",null,[H[16]||(H[16]=i("legend",null,"Which screen do you have?",-1)),i("div",ay,[i("label",ry,[ye(i("input",{type:"radio",name:"board",value:"cyd","onUpdate:modelValue":H[0]||(H[0]=ce=>t.board=ce)},null,512),[[Yi,t.board]]),H[14]||(H[14]=i("span",null,[i("b",null,"CYD · 2.8 inch"),i("small",null,"ESP32-2432S028 · 320 × 240")],-1))]),i("label",uy,[ye(i("input",{type:"radio",name:"board",value:"guition","onUpdate:modelValue":H[1]||(H[1]=ce=>t.board=ce)},null,512),[[Yi,t.board]]),H[15]||(H[15]=i("span",null,[i("b",null,"Guition · 4 inch"),i("small",null,"ESP32-S3-4848S040 · 480 × 480 · GT911")],-1))])])]),i("div",cy,[H[18]||(H[18]=i("label",{class:"f-label",for:"friendly_name"},"Name",-1)),ye(i("input",{id:"friendly_name",name:"friendly_name","onUpdate:modelValue":H[2]||(H[2]=ce=>t.friendly_name=ce),required:"",maxlength:"60",placeholder:"Living room screen",autocomplete:"off"},null,512),[[De,t.friendly_name]]),i("small",dy,[H[17]||(H[17]=X("Device name ",-1)),i("code",fy,m(E.value),1),i("button",{type:"button",class:"btn link mini",id:"edit-node",onClick:H[3]||(H[3]=ce=>{n.nodeEdited=!0,s.value=!0})},"customize")]),H[19]||(H[19]=i("small",null,"Every screen gets its own profile with its own keys. Four screens? Go through this four times with a different name.",-1))]),s.value?(p(),v("div",py,[H[20]||(H[20]=i("label",{class:"f-label",for:"node-name"},"Device name",-1)),ye(i("input",{id:"node-name",name:"name","onUpdate:modelValue":H[4]||(H[4]=ce=>t.name=ce),pattern:"[a-z][a-z0-9\\-]{0,29}",maxlength:"30",autocomplete:"off",onInput:H[5]||(H[5]=ce=>n.nodeEdited=!0)},null,544),[[De,t.name]]),H[21]||(H[21]=i("small",null,"Lowercase letters, digits, and dashes. A different name for each screen.",-1))])):j("",!0),L.value?(p(),v("fieldset",hy,[H[24]||(H[24]=i("legend",null,"Wi-Fi",-1)),i("p",vy,m(C.value),1),J.value.includes("wifi_ssid")?(p(),v("div",my,[H[22]||(H[22]=i("label",{class:"f-label",for:"wifi_ssid"},"Wi-Fi name (2.4 GHz)",-1)),ye(i("input",{id:"wifi_ssid",name:"wifi_ssid","onUpdate:modelValue":H[6]||(H[6]=ce=>t.wifi_ssid=ce),autocomplete:"off"},null,512),[[De,t.wifi_ssid]])])):j("",!0),J.value.includes("wifi_password")?(p(),v("div",yy,[H[23]||(H[23]=i("label",{class:"f-label",for:"wifi_password"},"Wi-Fi password",-1)),ye(i("input",{id:"wifi_password",name:"wifi_password",type:"password","onUpdate:modelValue":H[7]||(H[7]=ce=>t.wifi_password=ce),autocomplete:"new-password"},null,512),[[De,t.wifi_password]])])):j("",!0)])):j("",!0),i("div",gy,[H[26]||(H[26]=i("label",{class:"f-label",for:"install-target"},"Install via",-1)),ye(i("select",{id:"install-target",name:"target","onUpdate:modelValue":H[8]||(H[8]=ce=>t.target=ce),onChange:H[9]||(H[9]=ce=>{n.picked=!0,Se()})},[x.value.length?j("",!0):(p(),v("option",by,"USB · no board found on the Home Assistant machine yet")),(p(!0),v(B,null,ie(x.value,ce=>(p(),v("option",{key:ce,value:ce},m(D(ce)),9,wy))),128)),i("option",{value:"download"},m(jy)),H[25]||(H[25]=i("option",{value:""},"Later · save profile only",-1))],544),[[pn,t.target]]),i("small",_y,m(I.value),1)]),r.value?(p(),v("p",ky,m(r.value),1)):j("",!0),i("div",$y,[i("button",{type:"submit",class:"btn primary",id:"install-go",disabled:T.value},m(A.value),9,xy),i("span",Sy,m(c.value),1)])],32)):(p(),v("div",Cy,[i("div",Ty,[G.value?(p(),v("span",Ay)):(p(),v("span",{key:1,class:le(["outcome",M.value?"ok":"bad"]),id:"progress-mark"},m(M.value?"✓":"✕"),3)),i("strong",Ey,m(oe.value),1)]),i("p",Py,m(fe.value),1),M.value&&P.value&&n.view!=="done"?(p(),v("div",Oy,[i("a",{class:"btn primary",id:"download-firmware",href:Z.value.href,download:Z.value.name},"Download "+m(Z.value.name),9,Iy),i("ol",My,[H[30]||(H[30]=i("li",null,[i("b",null,"Plug the screen into your computer"),X(" with a USB data cable.")],-1)),i("li",null,[i("b",null,[H[27]||(H[27]=X("Open ",-1)),i("a",{href:Uy,target:"_blank",rel:"noopener"},"ESPHome Web")]),H[28]||(H[28]=X(" in Chrome or Edge, click Connect and choose the screen's USB port.",-1))]),i("li",null,[H[29]||(H[29]=i("b",null,"Click Install",-1)),X(" and select "+m(Z.value.name)+". The screen restarts and joins your Wi-Fi."+m(n.board==="cyd"?" The CYD first asks for a touch calibration: tap the crosshairs.":""),1)])]),H[31]||(H[31]=i("small",null,"The file holds your Wi-Fi password and the screen's keys: keep it to yourself.",-1))])):j("",!0),M.value?(p(),v("div",Ly,[i("div",Dy,[H[32]||(H[32]=i("span",null,"API key",-1)),i("code",{id:"api-key",ref_key:"keyBox",ref:h},m(n.apiKey||""),513),i("button",{type:"button",class:"btn quiet mini",id:"copy-key",onClick:H[10]||(H[10]=ce=>y(ct)(n.apiKey||"",h.value))},"Copy")]),i("ol",Fy,[(p(!0),v(B,null,ie(ue.value,([ce,ot],In)=>(p(),v("li",{key:In},[i("b",null,m(ce),1),X(m(ot),1),In===0?(p(),v("button",{key:0,type:"button",class:"btn quiet mini",onClick:H[11]||(H[11]=(...sn)=>y(Is)&&y(Is)(...sn))},"Open Devices & services")):j("",!0)]))),128))])])):j("",!0),n.view!=="done"?(p(),v("details",{key:2,id:"install-log-wrap",class:"log-wrap",open:u.value,onToggle:H[12]||(H[12]=ce=>u.value=ce.target.open)},[H[33]||(H[33]=i("summary",null,"ESPHome log",-1)),i("pre",Ry,m(a.value.join(`
`)),1)],40,Ny)):j("",!0),i("div",Hy,[!G.value&&!M.value?(p(),v("button",{key:0,type:"button",class:"btn primary",id:"install-retry",onClick:Fe},"Retry")):j("",!0),i("button",{type:"button",class:"btn quiet",id:"install-close",onClick:nn},m(M.value?"Install another screen":"Start over"),1),i("button",{type:"button",class:le(["btn",M.value?"primary":"quiet"]),onClick:ps},m(M.value?"Done":"Close"),3)])]))]))}}),Vy={class:"panel",id:"firmware-dialog"},Wy={class:"panel-head"},Ky={class:"card"},qy={class:"card-grid"},Yy={class:"field"},zy=["value"],Jy={class:"field"},Gy={key:0,value:"usb"},Xy=["value"],Zy={key:0,class:"field",id:"firmware-host-label"},Qy=["placeholder"],eg={class:"actions"},tg=["disabled"],ng=["disabled"],sg=["disabled"],og={key:0,class:"spin"},ig={id:"firmware-status",class:"status-line",role:"status"},lg={key:0,id:"firmware-download",class:"card",style:{background:"var(--surface-2)"}},ag=["href","download"],rg={id:"firmware-log",class:"log"},ug="https://web.esphome.io/?dashboard_install",cg="Download · flash from your own computer",dg=Te({__name:"FirmwareView",setup(e){const t=de(null),n=de(""),s=de("ota"),o=de("");let l=0;async function a(E=!1){try{const x=await ht("firmware");t.value=x,(E||!n.value)&&(n.value=x.profiles[0]?.file||"");const S=x.ports||[];s.value.startsWith("/")&&!S.includes(s.value)&&(s.value=S[0]||"usb"),s.value==="usb"&&S.length&&(s.value=S[0])}catch(x){ke(x.message)}}const r=k(()=>t.value?.job?.state==="running"),c=k(()=>!t.value||r.value||!t.value.available||!t.value.profiles?.length),f=k(()=>c.value||s.value==="usb"),u=k(()=>t.value?.ports||[]),h=k(()=>t.value?t.value.available?t.value.job?`${t.value.job.file} · ${t.value.job.action} · ${t.value.job.state}`:"Choose the intended profile, then a USB port, an IP address, or Download.":"The ESPHome CLI is missing. Update the app to 0.2.0.":"Loading…"),w=k(()=>s.value==="download"&&!!n.value&&!!t.value?.downloads?.includes(n.value)),$=k(()=>({href:`api/firmware/profiles/${encodeURIComponent(n.value)}/download`,name:n.value.replace(/\.yaml$/,"")+".factory.bin"}));async function D(E){try{await st("firmware/jobs","POST",{file:n.value,action:E==="validate"?"validate":E==="build"?"build":s.value==="download"?"download":"install",target:s.value==="ota"?o.value.trim():s.value==="download"?"":s.value}),await a()}catch(x){ke(x.message)}}return wn(()=>{a(!0),l=window.setInterval(()=>a(),3e3)}),On(()=>clearInterval(l)),(E,x)=>(p(),v("div",Vy,[i("div",Wy,[x[7]||(x[7]=$s('<div class="tx"><span class="eyebrow">Firmware &amp; USB</span><h1>Build and install screen firmware</h1><p>The built-in ESPHome CLI uses your own profile (YAML with keys) and secrets. Choose the screen&#39;s profile, then a USB port (screen connected to the Home Assistant machine), <b>Wi-Fi / OTA</b> with the hostname, or <b>Download</b> to put the firmware on the screen from your own computer. <b>Check</b> only validates, <b>Build only</b> compiles, <b>Build &amp; install</b> puts the firmware on the screen. Your tiles stay as they are in ESP Screens. The first build takes a few minutes.</p></div>',1)),i("button",{type:"button",class:"btn quiet",id:"close-firmware",onClick:x[0]||(x[0]=S=>y(Ee)(""))},"← Back")]),i("div",Ky,[i("div",qy,[i("div",Yy,[x[8]||(x[8]=i("label",{class:"f-label",for:"firmware-file"},"ESPHome profile",-1)),ye(i("select",{id:"firmware-file","onUpdate:modelValue":x[1]||(x[1]=S=>n.value=S)},[(p(!0),v(B,null,ie(t.value?.profiles||[],S=>(p(),v("option",{key:S.file,value:S.file},m(S.file),9,zy))),128))],512),[[pn,n.value]])]),i("div",Jy,[x[10]||(x[10]=i("label",{class:"f-label",for:"firmware-port"},"Install to",-1)),ye(i("select",{id:"firmware-port","onUpdate:modelValue":x[2]||(x[2]=S=>s.value=S)},[x[9]||(x[9]=i("option",{value:"ota"},"Wi-Fi / OTA",-1)),u.value.length?j("",!0):(p(),v("option",Gy,"USB · no board found on the Home Assistant machine yet")),(p(!0),v(B,null,ie(u.value,S=>(p(),v("option",{key:S,value:S},m(S),9,Xy))),128)),i("option",{value:"download"},m(cg))],512),[[pn,s.value]])]),s.value==="ota"?(p(),v("div",Zy,[x[11]||(x[11]=i("label",{class:"f-label",for:"firmware-host"},"IP address or hostname",-1)),ye(i("input",{id:"firmware-host","onUpdate:modelValue":x[3]||(x[3]=S=>o.value=S),placeholder:n.value?n.value.replace(/\.yaml$/,".local"):"screen-livingroom.local"},null,8,Qy),[[De,o.value]])])):j("",!0)]),i("div",eg,[i("button",{type:"button",class:"btn quiet",id:"firmware-validate",disabled:c.value,onClick:x[4]||(x[4]=S=>D("validate"))},"Check",8,tg),i("button",{type:"button",class:"btn quiet",id:"firmware-build",disabled:c.value,onClick:x[5]||(x[5]=S=>D("build"))},"Build only",8,ng),i("button",{type:"button",class:"btn primary",id:"firmware-install",disabled:f.value,onClick:x[6]||(x[6]=S=>D("install"))},m(s.value==="download"?"Build & download":"Build & install"),9,sg),r.value?(p(),v("span",og)):j("",!0)]),i("p",ig,m(h.value),1),w.value?(p(),v("div",lg,[i("a",{class:"btn primary",id:"firmware-download-link",href:$.value.href,download:$.value.name},"Download "+m($.value.name),9,ag),i("small",null,[x[12]||(x[12]=X("Put it on the screen with ",-1)),i("a",{href:ug,target:"_blank",rel:"noopener"},"ESPHome Web"),x[13]||(x[13]=X(" in Chrome or Edge: Connect, choose the screen's USB port, Install, and select this file. It holds your Wi-Fi password and the screen's keys: keep it to yourself.",-1))])])):j("",!0)]),i("pre",rg,m((t.value?.logs||[]).join(`
`)),1)]))}}),fg={class:"panel wide alerts",id:"alerts-dialog"},pg={class:"panel-head"},hg={key:0,class:"hint"},vg={class:"alert-hero"},mg={class:"alert-mock",id:"alert-mock","aria-hidden":"true"},yg={class:"mdi alert-mock-icon",id:"alert-mock-icon"},gg={class:"alerts-nav","aria-label":"Sections"},bg=["data-jump","onClick"],wg={id:"alerts-try",class:"card"},_g={class:"field"},kg={value:"all"},$g=["value","disabled"],xg={class:"field"},Sg={class:"field"},Cg={class:"field"},Tg={id:"try-icons"},Ag=["value"],Eg={class:"field"},Pg=["value"],Og={class:"field"},Ig={class:"field"},Mg={class:"check field"},Lg={class:"actions field wide"},Dg=["disabled"],Fg={class:"status-line",id:"try-result",role:"status"},Ng={id:"alerts-screens",class:"card"},Rg={id:"alerts-min-firmware"},Hg={id:"alerts-screen-list",class:"options"},Ug={key:0,class:"hint"},jg={class:"alert-screen-head"},Bg={class:"copy-label"},Vg=["onClick"],Wg={id:"alerts-howto",class:"card"},Kg={class:"field"},qg=["value"],Yg={key:0,value:""},zg={class:"copy-line"},Jg={id:"alerts-example"},Gg={id:"alerts-all",class:"card"},Xg={id:"alerts-all-event"},Zg={id:"alerts-all-dismiss"},Qg={class:"copy-line"},eb={id:"alerts-all-example"},tb={id:"alerts-fields",class:"card"},nb={class:"table-scroll"},sb={id:"alerts-field-table"},ob={key:0},ib={id:"alerts-icons",class:"card"},lb={class:"chips",id:"alerts-suggested"},ab=["onClick"],rb={class:"mdi"},ub={class:"field"},cb={id:"alerts-icon-groups"},db={class:"subhead"},fb={class:"alert-icon-grid"},pb=["title","onClick"],hb={class:"mdi"},vb={key:0},mb={key:0,class:"hint"},yb={id:"alerts-colors",class:"card"},gb={class:"swatches",id:"alerts-swatches"},bb=["onClick"],wb={id:"alerts-events",class:"card"},_b={id:"alerts-event-name"},kb={class:"table-scroll"},$b={id:"alerts-ending-table"},xb={class:"copy-line"},Sb={id:"alerts-wait-example"},Cb={id:"alerts-tips",class:"card"},Tb={class:"alerts-list"},Ab=Te({__name:"AlertsView",setup(e){const t=k(()=>d.inventory.alerts),n=yn({screen:"all",title:"Someone is at the door",subtitle:"Door 3, back",icon:"doorbell",color:"orange",button_text:"Coming",timeout:30,flash:!0}),s=de(!1),o=de(""),l=k(()=>d.inventory.screens.filter(A=>mn(A)&&A.online));async function a(){s.value=!0,o.value="";try{const{screen:A,...b}=n,T=await Wc(A,b),ne=A==="all"?`${T.sent} screen${T.sent===1?"":"s"}`:d.inventory.screens.find(Se=>Se.id===A)?.name||"the screen";o.value=T.sent?`Sent to ${ne}.${T.skipped?` ${T.skipped} skipped (offline or old firmware).`:""}${T.unusable?.length?` Left empty: ${T.unusable.join(", ")}.`:""}`:"No screen could show it: check that a screen is online with firmware "+(t.value?.min_firmware||"0.2.31")+" or newer."}catch(A){o.value=A.message}finally{s.value=!1}}const r=k(()=>d.inventory.icons),c=de(""),f=de(""),u=A=>`"${String(A).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,h=A=>A.type==="string"?/^[a-z][a-z0-9-]*$/.test(A.example)?A.example:u(A.example):A.example===!0?"true":A.example===!1?"false":String(A.example),w=k(()=>d.inventory.screens.filter(A=>A.alert_action)),$=k(()=>c.value||w.value[0]?.alert_action||""),D=k(()=>{const A=(t.value?.fields||[]).map(b=>` ${b.name}: ${h(b)}`);return`action: ${$.value||"esphome.<device_name>_show_alert"}
data:
${A.join(`
`)}`}),E=k(()=>["# Doorbell: show the alert and wait until someone presses the button.","actions:",` - action: ${$.value||"esphome.<device_name>_show_alert"}`," data:",' title: "Someone is at the door"',' subtitle: "Door 3, back"'," icon: doorbell"," color: orange",' button_text: "Coming"'," timeout: 0"," flash: true"," - wait_for_trigger:"," - trigger: event",` event_type: ${t.value?.event||"esphome.screen_alert"}`," event_data:"," action: ok",' timeout: "00:05:00"'," - if:"," - condition: template",' value_template: "{{ wait.trigger is not none }}"'," then:"," - action: notify.notify"," data:",' message: "Someone is coming to the door."'].join(`
`)),x=k(()=>{const A=(t.value?.fields||[]).map(T=>` ${T.name}: ${h(T)}`),b=t.value?.camera;return b&&A.push(` # ${b.name}: ${b.example} # a Guition shows its picture on the card`),`event: ${t.value?.broadcast?.show||"esp_screens_show_alert"}
event_data:
${A.join(`
`)}`}),S=k(()=>{if(!t.value||!r.value)return[];const A=f.value.trim().toLowerCase();return[...r.value.groups,{label:"Also available: control and weather icons",icons:t.value.extra_icons}].map(T=>({label:T.label,icons:T.icons.filter(ne=>!A||ne.name.includes(A)||(ne.label||"").toLowerCase().includes(A))})).filter(T=>T.icons.length)}),L=k(()=>t.value?.suggested_icons?.find(A=>A.name==="doorbell")),J=k(()=>t.value?.colors?.find(A=>A.name==="orange")),C={string:"text",int:"number",bool:"on / off"};function V(A){document.getElementById(A)?.scrollIntoView({behavior:"smooth",block:"start"})}const I=[["alerts-try","Try it"],["alerts-screens","Your screens"],["alerts-howto","In an automation"],["alerts-all","All screens"],["alerts-fields","The fields"],["alerts-icons","Icons"],["alerts-colors","Colors"],["alerts-behaviour","Behavior"],["alerts-events","Events"],["alerts-tips","Tips"]];return(A,b)=>(p(),v("div",fg,[i("div",pg,[b[15]||(b[15]=i("div",{class:"tx"},[i("span",{class:"eyebrow"},"Alerts · cheatsheet"),i("h1",null,"A full-screen notification, from an automation."),i("p",null,[X("Every screen has the "),i("code",null,"show_alert"),X(" action. It places a card over everything, wakes the screen, and keeps the backlight at normal brightness until someone taps the button or the timeout runs out. Home Assistant itself shows no explanation or dropdowns for ESPHome actions; everything you can fill in is listed here.")])],-1)),i("button",{type:"button",class:"btn quiet",id:"close-alerts",onClick:b[0]||(b[0]=T=>y(Ee)(""))},"← Back")]),t.value?(p(),v(B,{key:1},[i("div",vg,[i("div",mg,[i("div",{class:"alert-mock-card",style:Ae(J.value?{background:J.value.color}:void 0)},[i("span",yg,m(L.value?y(ge)(L.value.cp):""),1),b[16]||(b[16]=i("strong",{id:"alert-mock-title"},"Someone is at the door",-1)),b[17]||(b[17]=i("span",{id:"alert-mock-subtitle"},"Door 3, back",-1)),b[18]||(b[18]=i("span",{class:"fake",id:"alert-mock-button"},"Coming",-1))],4)]),i("nav",gg,[(p(),v(B,null,ie(I,([T,ne])=>i("button",{key:T,type:"button","data-jump":T,onClick:Se=>V(T)},m(ne),9,bg)),64))])]),i("section",wg,[b[28]||(b[28]=i("h2",null,"Try it",-1)),b[29]||(b[29]=i("p",null,"Send one alert now, with the same fields an automation sends. The screen shows the card and, with blinking on, flashes its backlight.",-1)),i("form",{class:"try-grid",onSubmit:ut(a,["prevent"])},[i("div",_g,[b[19]||(b[19]=i("label",{class:"f-label",for:"try-screen"},"Screen",-1)),ye(i("select",{id:"try-screen","onUpdate:modelValue":b[1]||(b[1]=T=>n.screen=T)},[i("option",kg,"All screens ("+m(l.value.length)+" ready)",1),(p(!0),v(B,null,ie(y(d).inventory.screens,T=>(p(),v("option",{key:T.id,value:T.id,disabled:!y(mn)(T)||!T.online},m(T.name)+m(y(mn)(T)&&T.online?"":" · not ready"),9,$g))),128))],512),[[pn,n.screen]])]),i("div",xg,[b[20]||(b[20]=i("label",{class:"f-label",for:"try-title"},"Title",-1)),ye(i("input",{id:"try-title","onUpdate:modelValue":b[2]||(b[2]=T=>n.title=T),maxlength:"64"},null,512),[[De,n.title]])]),i("div",Sg,[b[21]||(b[21]=i("label",{class:"f-label",for:"try-subtitle"},"Subtitle",-1)),ye(i("input",{id:"try-subtitle","onUpdate:modelValue":b[3]||(b[3]=T=>n.subtitle=T),maxlength:"240"},null,512),[[De,n.subtitle]])]),i("div",Cg,[b[22]||(b[22]=i("label",{class:"f-label",for:"try-icon"},"Icon",-1)),ye(i("input",{id:"try-icon","onUpdate:modelValue":b[4]||(b[4]=T=>n.icon=T),list:"try-icons",placeholder:"doorbell"},null,512),[[De,n.icon]]),i("datalist",Tg,[(p(!0),v(B,null,ie(t.value.suggested_icons,T=>(p(),v("option",{key:T.name,value:T.name},m(T.label||T.name),9,Ag))),128))])]),i("div",Eg,[b[24]||(b[24]=i("label",{class:"f-label",for:"try-color"},"Color",-1)),ye(i("select",{id:"try-color","onUpdate:modelValue":b[5]||(b[5]=T=>n.color=T)},[b[23]||(b[23]=i("option",{value:""},"White (default)",-1)),(p(!0),v(B,null,ie(t.value.colors,T=>(p(),v("option",{key:T.name,value:T.name},m(T.label),9,Pg))),128))],512),[[pn,n.color]])]),i("div",Og,[b[25]||(b[25]=i("label",{class:"f-label",for:"try-button"},"Button text",-1)),ye(i("input",{id:"try-button","onUpdate:modelValue":b[6]||(b[6]=T=>n.button_text=T),maxlength:"16"},null,512),[[De,n.button_text]])]),i("div",Ig,[b[26]||(b[26]=i("label",{class:"f-label",for:"try-timeout"},"Timeout (seconds, 0 waits for the button)",-1)),ye(i("input",{id:"try-timeout","onUpdate:modelValue":b[7]||(b[7]=T=>n.timeout=T),type:"number",min:"0",max:"86400"},null,512),[[De,n.timeout,void 0,{number:!0}]])]),i("label",Mg,[ye(i("input",{type:"checkbox",id:"try-flash","onUpdate:modelValue":b[8]||(b[8]=T=>n.flash=T)},null,512),[[lc,n.flash]]),b[27]||(b[27]=i("span",null,[X("Blink the backlight"),i("small",null,"Four times when the alert arrives.")],-1))]),i("div",Lg,[i("button",{type:"submit",class:"btn primary",id:"try-send",disabled:s.value||!l.value.length},m(s.value?"Sending…":"Send alert"),9,Dg),i("span",Fg,m(o.value),1)])],32)]),i("section",Ng,[b[32]||(b[32]=i("h2",null,"Your screens",-1)),i("p",null,[b[30]||(b[30]=X("Every screen has its own action, with the device name in it. From firmware ",-1)),i("code",Rg,m(t.value.min_firmware),1),b[31]||(b[31]=X("; update an older screen with its Update button under Screens.",-1))]),i("div",Hg,[y(d).inventory.screens.length?j("",!0):(p(),v("p",Ug,"No screen paired yet. Install one via New screen; the action appears once Home Assistant sees the screen.")),(p(!0),v(B,null,ie(y(d).inventory.screens,T=>(p(),v("div",{key:T.id,class:"alert-screen"},[i("div",jg,[i("strong",null,m(T.name),1),i("span",{class:le(["chip",y(Qt)(T.firmware,t.value.min_firmware)&&T.alert_action?"good":"update"])},m(y(Qt)(T.firmware,t.value.min_firmware)&&T.alert_action?`● firmware ${T.firmware}`:T.alert_action?`Update needed · firmware ${T.firmware||"unknown"}`:"Device name unknown · update the screen"),3)]),(p(!0),v(B,null,ie([["Show alert",T.alert_action],["Dismiss alert",T.dismiss_action]],([ne,Se])=>(p(),v("div",{key:ne,class:"copy-line"},[i("span",Bg,m(ne),1),i("code",null,m(Se||"esphome.<device_name>_show_alert"),1),Se?(p(),v("button",{key:0,type:"button",class:"btn quiet mini",onClick:Oe=>y(ct)(Se,void 0,"Action name")},"Copy",8,Vg)):j("",!0)]))),128))]))),128))])]),i("section",Wg,[b[34]||(b[34]=$s('<h2>In an automation</h2><ol class="steps"><li><b>Add action</b> and search for <b>ESPHome</b>. Choose your screen&#39;s action: Home Assistant calls it &quot;Performs the action show_alert of the node <i>device name</i>&quot;.</li><li><b>Fill in the fields.</b> Home Assistant asks for all seven; leave what you don&#39;t use empty (<code>&quot;&quot;</code>, <code>0</code>, off).</li><li>Prefer YAML? Choose <b>Edit in YAML</b> on the action and paste the example below.</li></ol>',2)),i("div",Kg,[b[33]||(b[33]=i("label",{class:"f-label",for:"alerts-example-screen"},"Example for",-1)),ye(i("select",{id:"alerts-example-screen","onUpdate:modelValue":b[9]||(b[9]=T=>c.value=T),style:{"max-width":"360px"}},[(p(!0),v(B,null,ie(w.value,T=>(p(),v("option",{key:T.id,value:T.alert_action},m(T.name),9,qg))),128)),w.value.length?j("",!0):(p(),v("option",Yg,"a screen (not paired yet)"))],512),[[pn,c.value]])]),i("div",zg,[i("pre",Jg,m(D.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-example-copy",onClick:b[10]||(b[10]=T=>y(ct)(D.value,void 0,"YAML"))},"Copy YAML")])]),i("section",Gg,[b[42]||(b[42]=i("h2",null,"All screens at once",-1)),i("p",null,[b[35]||(b[35]=X("Fire the event ",-1)),i("code",Xg,m(t.value.broadcast?.show||"esp_screens_show_alert"),1),b[36]||(b[36]=X(" with the same fields, and ESP Screens passes the alert on to every screen that is online, including screens you add later. ",-1)),i("code",Zg,m(t.value.broadcast?.dismiss||"esp_screens_dismiss_alert"),1),b[37]||(b[37]=X(" clears it everywhere. In an automation, add the ",-1)),b[38]||(b[38]=i("b",null,"Event",-1)),b[39]||(b[39]=X(" action or paste the example under ",-1)),b[40]||(b[40]=i("b",null,"Edit in YAML",-1)),b[41]||(b[41]=X(". Leave out the fields you don't use. ESP Screens has to be running for this.",-1))]),i("div",Qg,[i("pre",eb,m(x.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-all-copy",onClick:b[11]||(b[11]=T=>y(ct)(x.value,void 0,"YAML"))},"Copy YAML")])]),i("section",tb,[b[46]||(b[46]=i("h2",null,"The fields",-1)),b[47]||(b[47]=i("p",null,"Text is free-form; the limit is in bytes, and an accented letter counts as two. What doesn't fit gets an ellipsis (title) or is dropped (subtitle).",-1)),i("div",nb,[i("table",sb,[b[45]||(b[45]=i("tr",null,[i("th",null,"Field"),i("th",null,"Type"),i("th",null,"What it does"),i("th",null,"Example"),i("th",null,"Limit")],-1)),(p(!0),v(B,null,ie(t.value.fields,T=>(p(),v("tr",{key:T.name},[i("td",null,[i("code",null,m(T.name),1),i("small",null,m(T.label),1)]),i("td",null,m(C[T.type]||T.type),1),i("td",null,m(T.help),1),i("td",null,[i("code",null,m(typeof T.example=="string"?T.example:String(T.example)),1)]),i("td",null,m(t.value.limits.cyd[T.name]?`CYD ${t.value.limits.cyd[T.name]} · Guition ${t.value.limits.guition[T.name]} bytes`:T.type==="int"?"0 to 86400 s":"—"),1)]))),128)),t.value.camera?(p(),v("tr",ob,[i("td",null,[i("code",null,m(t.value.camera.name),1),i("small",null,m(t.value.camera.label),1)]),b[43]||(b[43]=i("td",null,"entity",-1)),i("td",null,m(t.value.camera.help),1),i("td",null,[i("code",null,m(t.value.camera.example),1)]),b[44]||(b[44]=i("td",null,"Guition, firmware 0.2.57+",-1))])):j("",!0)])])]),i("section",ib,[b[49]||(b[49]=i("h2",null,"Icons",-1)),b[50]||(b[50]=i("p",null,[X("Fill in the name in "),i("code",null,"icon"),X(", for example "),i("code",null,"doorbell"),X(". "),i("code",null,"mdi:doorbell"),X(" and the hex codepoint ("),i("code",null,"F12E6"),X(") also work. Only these icons are included in the firmware; any other name shows the warning triangle. Tap an icon to copy its name.")],-1)),b[51]||(b[51]=i("p",{class:"subhead"},"Handy for notifications",-1)),i("div",lb,[(p(!0),v(B,null,ie(t.value.suggested_icons,T=>(p(),v("button",{key:T.name,type:"button",class:"chip",onClick:ne=>y(ct)(T.name,void 0,"Icon name")},[i("span",rb,m(y(ge)(T.cp)),1),i("code",null,m(T.name),1)],8,ab))),128))]),i("div",ub,[b[48]||(b[48]=i("label",{class:"f-label",for:"alerts-icon-search"},"Search for an icon",-1)),ye(i("input",{id:"alerts-icon-search","onUpdate:modelValue":b[12]||(b[12]=T=>f.value=T),type:"search",placeholder:"Search by name or description…",autocomplete:"off"},null,512),[[De,f.value]])]),i("div",cb,[(p(!0),v(B,null,ie(S.value,T=>(p(),v("div",{key:T.label,class:"field"},[i("p",db,m(T.label)+" · "+m(T.icons.length),1),i("div",fb,[(p(!0),v(B,null,ie(T.icons,ne=>(p(),v("button",{key:ne.name,type:"button",class:"alert-icon",title:`Copy ${ne.name}`,onClick:Se=>y(ct)(ne.name,void 0,"Icon name")},[i("span",hb,m(y(ge)(ne.cp)),1),i("code",null,m(ne.name),1),ne.label?(p(),v("small",vb,m(ne.label),1)):j("",!0)],8,pb))),128))])]))),128)),S.value.length?j("",!0):(p(),v("p",mb,'No icon for "'+m(f.value)+'". Unknown names show the warning triangle ('+m(t.value.fallback_icon)+").",1))])]),i("section",yb,[b[53]||(b[53]=i("h2",null,"Colors",-1)),b[54]||(b[54]=i("p",null,[X("Fill in the name in "),i("code",null,"color"),X(". These are the pastel shades of the tiles, with dark text. Empty or unknown gives the white card. Tap to copy.")],-1)),i("div",gb,[i("button",{type:"button",class:"swatch",onClick:b[13]||(b[13]=T=>y(ct)("",void 0,"Empty color"))},[...b[52]||(b[52]=[i("i",{style:{background:"#ffffff"}},null,-1),i("span",null,[i("code",null,"empty"),i("small",null,"White (default)")],-1)])]),(p(!0),v(B,null,ie(t.value.colors,T=>(p(),v("button",{key:T.name,type:"button",class:"swatch",onClick:ne=>y(ct)(T.name,void 0,"Color name")},[i("i",{style:Ae({background:T.color})},null,4),i("span",null,[i("code",null,m(T.name),1),i("small",null,m(T.label)+" · "+m(T.color),1)])],8,bb))),128))])]),b[75]||(b[75]=$s('<section id="alerts-behaviour" class="card"><h2>Behavior</h2><ul class="alerts-list"><li><b>Wakes the screen.</b> An alert immediately wakes a dimmed or dark screen and appears above every page, every open light card, and the standby layer.</li><li><b>On until the button.</b> As long as the card is showing, the backlight stays at normal brightness. Standby and night hours wait. After the button, the regular standby time starts again.</li><li><b>Timeout.</b> <code>timeout: 0</code> waits for the button, however long that takes. With <code>timeout: 60</code> the card disappears after a minute, but the button closes it sooner.</li><li><b>Blinking.</b> <code>flash: true</code> blinks the backlight four times when the alert arrives (about a second) and leaves the screen on afterward.</li><li><b>Replacing.</b> A new alert replaces the current one; there&#39;s no stack. The replaced alert reports itself as <code>replaced</code>.</li><li><b>Closing remotely.</b> <code>dismiss_alert</code> clears the card, for example if the door is already open. Without an alert, that action does nothing.</li><li><b>Tapping beside the card</b> does nothing; only the button closes it. That way a wake-up tap never accidentally dismisses the alert.</li></ul></section>',1)),i("section",wb,[b[66]||(b[66]=i("h2",null,"Events",-1)),i("p",null,[b[55]||(b[55]=X("Every end fires the event ",-1)),i("code",_b,m(t.value.event),1),b[56]||(b[56]=X(" with ",-1)),b[57]||(b[57]=i("code",null,"action",-1)),b[58]||(b[58]=X(", ",-1)),b[59]||(b[59]=i("code",null,"title",-1)),b[60]||(b[60]=X(", ",-1)),b[61]||(b[61]=i("code",null,"screen",-1)),b[62]||(b[62]=X(" (the device name) and the ",-1)),b[63]||(b[63]=i("code",null,"device_id",-1)),b[64]||(b[64]=X(" that Home Assistant adds. Visible under Settings → Tools → Events.",-1))]),i("div",kb,[i("table",$b,[b[65]||(b[65]=i("tr",null,[i("th",null,"action"),i("th",null,"When")],-1)),(p(!0),v(B,null,ie(t.value.endings,T=>(p(),v("tr",{key:T.action},[i("td",null,[i("code",null,m(T.action),1)]),i("td",null,m(T.label),1)]))),128))])]),b[67]||(b[67]=i("p",{class:"subhead"},"Waiting until someone presses the button",-1)),i("div",xb,[i("pre",Sb,m(E.value),1),i("button",{type:"button",class:"btn quiet mini",id:"alerts-wait-copy",onClick:b[14]||(b[14]=T=>y(ct)(E.value,void 0,"YAML"))},"Copy YAML")])]),i("section",Cb,[b[74]||(b[74]=i("h2",null,"Tips",-1)),i("ul",Tb,[b[72]||(b[72]=$s("<li>Use a <b>color per kind of notification</b>: orange for the door, red for smoke or water, green for &quot;done&quot;. The text always stays dark and readable.</li><li>Keep the title <b>short</b>; a screen shows about twenty characters on one line and ends a longer title with an ellipsis. Put details in the subtitle.</li><li>A <b>custom button text</b> turns the notification into a question: &quot;Coming&quot;, &quot;Seen&quot;, &quot;Turn off&quot;. The event then tells you who responded.</li><li>For an alert that resolves itself (the door opens, the laundry gets taken out) close it in the same automation with <code>dismiss_alert</code>.</li>",4)),i("li",null,[b[68]||(b[68]=X("Every screen? Fire ",-1)),i("code",null,m(t.value.broadcast?.show||"esp_screens_show_alert"),1),b[69]||(b[69]=X(" once (see All screens at once). The screens still work independently and each reports with its own ",-1)),b[70]||(b[70]=i("code",null,"screen",-1)),b[71]||(b[71]=X(".",-1))]),b[73]||(b[73]=i("li",null,[X("Rather "),i("b",null,"ask Claude"),X(" for the automation? Install the ESP Screens skill under Settings → Claude.")],-1))])])],64)):(p(),v("p",hg,"The cheatsheet is still loading; one moment."))]))}}),Eb={class:"panel",id:"override-dialog"},Pb={class:"panel-head"},Ob={class:"tx"},Ib={id:"override-title"},Mb={class:"notice"},Lb={class:"mdi"},Db={class:"file-row"},Fb={id:"override-file"},Nb={class:"yaml-editor",id:"yaml-editor-wrap"},Rb={class:"actions"},Hb={id:"override-count",class:"hint"},Ub={class:"actions"},jb=["disabled"],Bb=["disabled"],Vb=`# Hardware-specific changes for this screen.
# This file is kept when the shared firmware package updates.
# Do not add esphome:, api:, ota:, wifi: or packages: here.
# Example: a CYD with the ST7789V display controller.
# "!extend" changes the display the shared package already defines;
# a bare id would add a second, incomplete display and fail the build.
display:
- id: !extend my_display
model: ST7789V
`,Wb=Te({__name:"OverrideView",setup(e){const t=k(()=>d.overrideProfile),n=de(""),s=de(""),o=de(!1),l=de("Loading…"),a=de(""),r=de(!1),c=de(null),f=de(null),u=k(()=>n.value.split(`
`).length),h=k(()=>Array.from({length:u.value},(I,A)=>A+1).join(`
`)),w=k(()=>`${n.value.length} characters · ${u.value} line${u.value===1?"":"s"}`);let $=!0;function D(I,A=""){l.value=I,a.value=A}async function E(){if(!t.value){D("No ESPHome profile was found for this screen.","error");return}D("Loading…");try{const I=await ht(`firmware/profiles/${encodeURIComponent(t.value)}/override`);s.value=I.override_file,o.value=!!I.attached,n.value=I.exists&&I.content!==`{}
`?I.content:"",D(I.attached?"Changes here apply on the next build.":"Save once to attach this file to the profile.")}catch(I){D(I.message,"error")}}async function x(I=!1){if(!(!t.value||r.value)){r.value=!0,D("Checking and saving…");try{const A=await st(`firmware/profiles/${encodeURIComponent(t.value)}/override`,"PUT",{content:n.value});if(s.value=A.override_file,o.value=!0,!I){D("Saved. The override is kept during firmware updates.","ok"),ke("Override YAML saved.");return}D("Saved. ESPHome is checking the complete profile…"),await st("firmware/jobs","POST",{file:t.value,action:"validate"}),S()}catch(A){D(A.message,"error")}finally{r.value=!1}}}function S(){const I=Date.now(),A=t.value,b=async()=>{if(!(!$||t.value!==A))try{const T=await ht("firmware"),ne=T.job;if(ne&&ne.file===A&&ne.state==="running")D(`ESPHome is checking the profile… ${ne.stage||""}`.trim());else if(ne&&ne.file===A&&ne.state==="success"){D("The complete profile is valid. Safe to build and install.","ok");return}else if(ne&&ne.file===A&&ne.state==="failed"){const Se=(T.logs||[]).filter(Oe=>/error|failed/i.test(Oe)).pop();D(Se||"ESPHome rejected the complete profile. See Firmware & USB for the full log.","error");return}Date.now()-I<72e5&&setTimeout(b,1200)}catch(T){D(T.message,"error")}};b()}function L(){(!n.value.trim()||confirm("Replace the current text with the example?"))&&(n.value=Vb,D("Example loaded. Save it when you are ready."),c.value?.focus())}function J(){(!n.value.trim()||confirm("Clear the local override?"))&&(n.value="",D("The override will be empty after you save."),c.value?.focus())}function C(I){const A=c.value;if(I.key==="Tab"){I.preventDefault();const b=A.selectionStart,T=A.selectionEnd;A.setRangeText(" ",b,T,"end"),n.value=A.value}else(I.ctrlKey||I.metaKey)&&I.key.toLowerCase()==="s"&&(I.preventDefault(),x(!1))}function V(){f.value&&c.value&&(f.value.scrollTop=c.value.scrollTop)}return wn(E),On(()=>{$=!1}),(I,A)=>(p(),v("div",Eb,[i("div",Pb,[i("div",Ob,[A[4]||(A[4]=i("span",{class:"eyebrow"},"Advanced · local override",-1)),i("h1",Ib,"Override YAML"+m(y(d).overrideFriendly?` · ${y(d).overrideFriendly}`:""),1),A[5]||(A[5]=i("p",null,"This small file is yours. It is loaded after the shared screen package and stays in place when ESP Screen Manager updates. Change hardware-specific details here, such as a display model.",-1))]),i("button",{type:"button",class:"btn quiet",id:"close-override",onClick:A[0]||(A[0]=b=>y(Ee)(""))},"← Back")]),i("div",Mb,[i("span",Lb,m(y(ge)("F0493")),1),A[6]||(A[6]=i("div",null,[i("strong",null,"What is safe to change?"),i("span",null,"Display, touchscreen, substitutions, pins and other device details. Name, Wi-Fi, API, OTA and package links remain managed.")],-1))]),i("div",Db,[i("code",Fb,m(s.value||t.value||""),1),i("span",{id:"override-state",class:le(["chip",{good:o.value}])},m(o.value?"Active":"Ready to attach"),3)]),i("div",Nb,[i("div",{ref_key:"gutter",ref:f,class:"yaml-gutter",id:"override-gutter","aria-hidden":"true"},m(h.value),513),ye(i("textarea",{ref_key:"editor",ref:c,id:"override-editor","onUpdate:modelValue":A[1]||(A[1]=b=>n.value=b),spellcheck:"false",autocapitalize:"off",autocomplete:"off",autocorrect:"off","aria-label":"Local override YAML",placeholder:`# Example
display:
- id: !extend my_display
model: ST7789V`,onKeydown:C,onScroll:V},null,544),[[De,n.value]])]),i("div",Rb,[i("button",{type:"button",class:"btn quiet mini",id:"override-example",onClick:L},"Use example"),i("button",{type:"button",class:"btn quiet mini",id:"override-empty",onClick:J},"Clear"),i("span",Hb,m(w.value),1)]),i("p",{id:"override-status",class:le(["status-line",a.value]),role:"status"},m(l.value),3),i("div",Ub,[i("button",{type:"button",class:"btn quiet",id:"override-check",disabled:r.value||!t.value,onClick:A[2]||(A[2]=b=>x(!0))},"Save & check",8,jb),i("button",{type:"button",class:"btn primary",id:"override-save",disabled:r.value||!t.value,onClick:A[3]||(A[3]=b=>x(!1))},"Save override",8,Bb)])]))}}),Kb={class:"main"},qb=Te({__name:"App",setup(e){const t=k(()=>lt.value==="#settings"?ty:lt.value==="#new-screen"?By:lt.value==="#firmware"?dg:lt.value==="#alerts"?Ab:lt.value==="#override"?Wb:Tt.value&&d.layout?Im:Dm);function n(s){(s.metaKey||s.ctrlKey)&&s.key.toLowerCase()==="k"&&(s.preventDefault(),d.palette=!d.palette)}return wn(()=>document.addEventListener("keydown",n)),On(()=>document.removeEventListener("keydown",n)),(s,o)=>(p(),v("div",{class:le(["app",{dragging:y(d).drag.active}])},[we(Pd),i("main",Kb,[(p(),Je(Jr(t.value)))]),we(Id),we(Bd)],2))}});pc(qb).mount("#app");id();