Home-AssistantConfig/config/www/community/frigate-hass-card/card-c642ee74.js

651 lines
518 KiB
JavaScript
Raw Normal View History

2024-12-17 17:05:10 +00:00
function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError;
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdateP
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"<svg>":"",o=P;for(let t=0;t<n;t++){const n=e[t];let s,c,l=-1,d=0;for(;d<n.length&&(o.lastIndex=d,c=o.exec(n),null!==c);)d=o.lastIndex,o===P?"!--"===c[1]?o=L:void 0!==c[1]?o=N:void 0!==c[2]?(B.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=F):void 0!==c[3]&&(o=F):o===F?">"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"<?>")+(2===t?"</svg>":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length<o;){if(1===a.nodeType){if(a.hasAttributes())for(const e of a.getAttributeNames())if(e.endsWith($)){const t=l[r++],n=a.getAttribute(e).split(A),o=/([.?@])?(.*)/.exec(t);s.push({type:1,index:i,name:o[2],strings:n,ctor:"."===o[1]?ne:"?"===o[1]?ae:"@"===o[1]?ie:te}),a.removeAttribute(e)}else e.startsWith(A)&&(s.push({type:6,index:i}),a.removeAttribute(e));if(B.test(a.tagName)){const e=a.textContent.split(A),t=e.length-1;if(t>0){a.textContent=S?S.emptyScript:"";for(let n=0;n<t;n++)a.append(e[n],j()),Q.nextNode(),s.push({type:2,index:++i});a.append(e[t],j())}}}else if(8===a.nodeType)if(a.data===z)s.push({type:2,index:i});else{let e=-1;for(;-1!==(e=a.data.indexOf(A,e+1));)s.push({type:7,index:i}),e+=A.length-1}i++}}static createElement(e,t){const n=T.createElement("template");return n.innerHTML=e,n}}function X(e,t,n=e,a){if(t===U)return t;let i=void 0!==a?n._$Co?.[a]:n._$Cl;const r=O(t)?void 0:t._$litDirective$;return i?.constructor!==r&&(i?._$AO?.(!1),void 0===r?i=void 0:(i=new r(e),i._$AT(e,n,a)),void 0!==a?(n._$Co??=[])[a]=i:n._$Cl=i),void 0!==i&&(t=X(e,i._$AS(e,t.values),i,a)),t}let J=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,a=(e?.creationScope??T).importNode(t,!0);Q.currentNode=a;let i=Q.nextNode(),r=0,o=0,s=n[0];for(;void 0!==s;){if(r===s.index){let t;2===s.type?t=new ee(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new re(i,this,e)),this._$AV.push(t),s=n[++o]}r!==s?.index&&(i=Q.nextNode(),r++)}return Q.currentNode=T,a}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}};class ee{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,a){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=X(this,e,t),O(e)?e===W||null==e||""===e?(this._$AH!==W&&this._$AR(),this._$AH=W):e!==this._$AH&&e!==U&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
let se=class extends M{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/}function pe(e){return he({...e,state:!0,attribute:!1})}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e<a.length;e++)Ce(a[e],!1),Me(a[e]);else null!=a&&(Ce(a,!1),Me(a));else Ce(this,e)}const $e=e=>{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}});
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t<div id="start"></div>\n\t<div id="backup"></div>\n\t<slot></slot>\n\t<div id="end"></div>\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n <style>*{box-sizing:border-box}:host{padding:var(--dialog-container-padding,5vw 24px);z-index:var(--dialog-z-index,12345678);outline:none}#backdrop,:host{position:fixed;top:0;left:0;bottom:0;right:0}:host,:host([center]) #dialog{overflow-x:var(--dialog-overflow-x,hidden);overflow-y:var(--dialog-overflow-y,auto);overscroll-
/* istanbul ignore if: the if path cannot be reached -- @preserve */
if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS();
/* istanbul ignore if: the if path cannot be reached -- @preserve */
if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null;
/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&t<n||"latest"===e&&t>n)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t};
/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})<n)return!1}}return!0}async getMediaSeekTime(e,t){const n=e.getStartTime(),a=e.getEndTime(),i=this._store.getEngineForMedia(e),r=this._api.getHASSManager().getHASS();return!r||!i||!n||!a||t<n||t>a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null;
/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++a<i;){var r=t(e[a]);void 0!==r&&(n=void 0===n?r:n+r)}return n}(l,eg):0;var l;return B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager request [Input queries:",n.length,", Cached output queries:",c,", Total output queries:",a.size,", Duration:",((new Date).getTime()-i.getTime())/1e3+"s,",", Queries:",n,", Results:",a,", Options:",t??{},"]"),a}_convertQueryResultsToMedia(e){const t=[],n=this._api.getHASSManager().getHASS();if(!n)return t;for(const[a,i]of e.entries()){const e=this._store.getEngineOfType(i.engine);if(e){let r=null;
/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(a)&&ny.isEventQueryResult(i)?r=e.generateMediaFromEvents(n,this._store,a,i):ty.isRecordingQuery(a)&&ny.isRecordingQueryResult(i)&&(r=e.generateMediaFromRecordings(n,this._store,a,i)),r&&t.push(...r)}}return ey(t)}getCameraEndpoints(e,t){const n=this._store.getCameraConfig(e),a=this._store.getEngineForCameraID(e);return n&&a?a.getCameraEndpoints(n,t):null}getCameraMetadata(e){const t=this._store.getCameraConfig(e),n=this._store.getEngineForCameraID(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?n.getCameraMetadata(a,t):null}getCameraCapabilities(e){return this._store.getCamera(e)?.getCapabilities()??null}getAggregateCameraCapabilities(e){const t=[...e??this._store.getCameraIDs()].map((e=>this._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_dele
/* istanbul ignore else: the else path cannot be reached -- @preserve */
void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"downloa
/* istanbul ignore next: this path cannot be reached -- @preserve */
/* istanbul ignore next: this path cannot be reached -- @preserve */
return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"g
/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()
/* istanbul ignore next: the case of config being null here cannot be
reached, as there's no way to have the untrigger call happen without
a config. -- @preserve */
this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraMan
/* istanbul ignore if: this path cannot be reached -- @preserve */
if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */
null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live;
/* istanbul ignore if: this if branch cannot be reached as if the config is
empty this function is never called -- @preserve */
return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o);
/* istanbul ignore if: the if path cannot be reached as the view is set
above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-c3e576d8.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardEleme
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;n<t;n+=1)a+=e;return a},jx={isNothing:Ix,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:Ix(e)?[]:[e]},repeat:Tx,isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,a,i,r;if(t)for(n=0,a=(r=Object.keys(t)).length;n<a;n+=1)e[i=r[n]]=t[i];return e}};function Ox(e,t){var n="",a=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),a+" "+n):a}function Dx(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Ox(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}Dx.prototype=Object.create(Error.prototype),Dx.prototype.constructor=Dx,Dx.prototype.toString=function(e){return this.name+": "+Ox(this,e)};var Rx=Dx;function Px(e,t,n,a,i){var r="",o="",s=Math.floor(i/2)-1;return a-t>s&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implic
<div class="message padded">
<div class="icon">
<ha-icon icon="${e}"> </ha-icon>
</div>
<div class="contents">
<span class="${_e(t)}">
${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""}
</span>
${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""}
</div>
</div>
</div>`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` <frigate-card-message
.message=${q` ${this.message.message}.
<a href="${xa}"> ${V_("error.troubleshooting")}</a>.`}
.icon=${this.message.icon??"mdi:alert-circle"}
.context=${this.message.context}
.dotdotdot=${this.message.dotdotdot}
>
</frigate-card-message>`}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q` <div class="message vertical">
${this.animated?q`<ha-circular-progress active="true" size="${this.size}">
</ha-circular-progress>`:q`<ha-icon icon="mdi:timer-sand"></ha-icon>`}
${this.message?q`<span>${this.message}</span>`:q``}
</div>`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` <frigate-card-error-message
.message=${e}
></frigate-card-error-message>`:e?q` <frigate-card-message
.message=${e.message}
.icon=${e.icon}
.context=${e.context}
.dotdotdot=${e.dotdotdot}
></frigate-card-message>`:q``}function xk(e){return q`
<frigate-card-progress-indicator
class="${_e(e?.classes??{})}"
.size=${e?.size}
${e?.componentRef?je(e.componentRef):""}
.message=${e?.message||""}
.animated=${e?.cardWideConfig?.performance?.features.animated_progress_indicator??!0}
>
</frigate-card-progress-indicator>
`}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q`<frigate-card-elements-core
.hass=${this.hass}
.conditionsManagerEpoch=${this.conditionsManagerEpoch}
.elements=${this.elements}
>
</frigate-card-elements-core>`}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` <frigate-card-elements-core
.hass=${this.hass}
.elements=${this._config?.elements}
>
</frigate-card-elements-core>`}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` <img src="${"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' sodipodi:docname='camera-iris.svg' id='svg4' version='1.1' viewBox='0 0 24 24' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs8' /%3e %3csodipodi:namedview id='namedview6' pagecolor='%23b93e3e' bordercolor='black' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.60784314' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='26.62506' inkscape:cx='-1.934268' inkscape:cy='15.680716' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg4' /%3e %3cg id='g1119' style='fill-opacity:0.05%3bfill:white'%3e %3ccircle style='fill:white%3bfill-opacity:0.05%3bstroke-width:1.39729' id='path170' cx='12' cy='12' inkscape:label='White Background' r='11.25' /%3e %3cpath d='M 13.730001%2c15 9.8300003%2c21.76 C 10.53%2c21.91 11.25%2c22 12%2c22 c 2.400001%2c0 4.6%2c-0.85 6.32%2c-2.25 L 14.660001%2c13.4 M 2.4600003%2c15 c 0.92%2c2.92 3.15%2c5.26 5.99%2c6.34 L 12.12%2c15 m -3.5799997%2c-3 -3.9%2c-6.7499996 c -1.64%2c1.749999 -2.64%2c4.1399993 -2.64%2c6.7499996 0%2c0.68 0.07%2c1.35 0.2%2c2 h 7.49 M 21.8%2c9.9999997 H 14.310001 L 14.600001%2c10.5 19.36%2c18.75 C 21%2c16.97 22%2c14.6 22%2c12 22%2c11.31 21.93%2c10.64 21.8%2c9.9999997 m -0.26%2c-1 C 20.62%2c6.0700005 18.39%2c3.7400002 15.550001%2c2.6600002 L 11.88%2c8.9999997 M 9.4000003%2c10.5 14.170001%2c2.2400002 c -0.7%2c-0.15 -1.420001%2c-0.24 -2.170001%2c-0.24 -2.3999997%2c0 -4.5999997%2c0.84 -6.3199997%2c2.2500003 l 3.66%2c6.3499995 z' id='path2' inkscape:label='Iris' style='fill-opacity:0.05%3bfill:white' /%3e %3c/g%3e%3c/svg%3e"}" /> `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){
<mwc-list-item
style="${Re(t.style||{})}"
graphic=${ve(t.icon?"icon":void 0)}
?twoline=${!!e.subtitle}
?selected=${e.selected}
?activated=${e.selected}
?disabled=${!1===e.enabled}
aria-label="${t.title||""}"
@action=${t=>{t.detail.config=e}}
.actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})}
>
<span>${t.title||""}</span>
${e.subtitle?q`<span slot="secondary">${e.subtitle}</span>`:""}
${(e=>{if(e.icon){const t=Uk(e.icon);return t?q`<img
style="${Re(e.style||{})}"
data-domain=${ve(e.data_domain)}
data-state=${ve(e.data_state)}
slot="graphic"
src=${t}
/>`:q` <ha-icon
style="${Re(e.style||{})}"
data-domain=${ve(e.data_domain)}
data-state=${ve(e.data_state)}
slot="graphic"
icon="${e.icon||""}"
>
</ha-icon>`}return q``})(t)}
</mwc-list-item>
`}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q`
<ha-button-menu
corner=${"BOTTOM_LEFT"}
@closed=${e=>e.stopPropagation()}
@click=${e=>wf(e)}
>
<ha-icon-button
style="${Re(this.submenu.style||{})}"
class="button"
slot="trigger"
.label=${this.submenu.title||""}
.actionHandler=${kf({allowPropagation:!0,hasHold:bf(this.submenu.hold_action),hasDoubleClick:bf(this.submenu.double_tap_action)})}
>
<ha-icon icon="${this.submenu.icon}"></ha-icon>
</ha-icon-button>
${e.map(this._renderItem.bind(this))}
</ha-button-menu>
`}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[
.hass=${this.hass}
.submenu=${this._generatedSubmenu}
></frigate-card-submenu>`}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` <frigate-card-submenu
.hass=${this.hass}
.submenu=${e}
@action=${e=>this._controller.actionHandler(e)}
>
</frigate-card-submenu>`;if("custom:frigate-card-menu-submenu-select"===e.type)return q` <frigate-card-submenu-select
.hass=${this.hass}
.submenuSelect=${e}
.entityRegistryManager=${this.entityRegistryManager}
@action=${e=>this._controller.actionHandler(e)}
>
</frigate-card-submenu-select>`;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` <ha-icon-button
data-domain=${ve(t.data_domain)}
data-state=${ve(t.data_state)}
class="button"
style="${Re(t.style||{})}"
.actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})}
.label=${t.title||""}
@action=${t=>this._controller.actionHandler(t,e)}
>
${n?q`<img src="${n}" />`:q`<ha-icon
icon="${t.icon||"mdi:gesture-tap-button"}"
></ha-icon>`}
</ha-icon-button>`}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q` <div
class="matching"
style="${Re({flex:String(n.length)})}"
>
${n.map((e=>this._renderButton(e)))}
</div>
<div
class="opposing"
style="${Re({flex:String(a.length)})}"
>
${a.map((e=>this._renderButton(e)))}
</div>`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon
<slot name="top"></slot>
<slot name="left"></slot>
<slot name="right"></slot>
<slot name="bottom"></slot>
`}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[
/* istanbul ignore else: cannot happen -- @preserve */
return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q`
<div class="status">
${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`<div
.actionHandler=${n}
class="${t}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
>
${e.string}
</div>`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`<img
.actionHandler=${n}
class="${t}"
src="${a}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
/>`:q`<ha-icon
.actionHandler=${n}
class="${t}"
icon="${e.icon}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
></ha-icon>`}return"custom:frigate-card-status-bar-image"===e.type?q`<img
.actionHandler=${n}
class="${t}"
src="${e.image}"
@action=${t=>this._controller.actionHandler(t,e.actions)}
/>`:void 0}))}
</div>
`}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[
<slot name="previous"></slot>
<div ${je(this._refRoot)} class="embla__viewport">
<div class="embla__container">
<slot ${je(this._refParent)}></slot>
</div>
</div>
<slot name="next"></slot>
</div>`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE);
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constr
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q`<ha-icon
icon="mdi:image-off"
title=${V_("thumbnail.no_thumbnail")}
></ha-icon> `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q`<img src="${e}" />`:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q`
${this.cameraMetadata?.engineLogo?q`<img class="background" src="${this.cameraMetadata.engineLogo}" />`:""}
<div class="content">
<div class="title">${Wu(this.date,"HH:mm")}</div>
<div class="subtitle">${Wu(this.date,"MMM do")}</div>
${this.showCameraTitle&&this.cameraMetadata?.title?q`<div class="camera">${this.cameraMetadata.title}</div>`:q``}
</div>
`}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q`
${d?q` <div class="title">
<span title=${d}>${d}</span>
${t?q`<span title="${t}">${t}</span>`:""}
</div>`:""}
<div class="details">
${a?q` <div>
<ha-icon
title=${V_("event.start")}
.icon=${"mdi:calendar-clock-outline"}
></ha-icon>
<span title="${a}">${a}</span>
</div>
${r||o?q` <div>
<ha-icon
title=${V_("event.duration")}
.icon=${"mdi:clock-outline"}
></ha-icon>
${r?q`<span title="${r}">${r}</span>`:""}
${o?q`<span title="${o}">${o}</span>`:""}
</div>`:""}`:""}
${this.cameraTitle?q` <div>
<ha-icon title=${V_("event.camera")} .icon=${"mdi:cctv"}></ha-icon>
<span title="${this.cameraTitle}">${this.cameraTitle}</span>
</div>`:""}
${c?q` <div>
<ha-icon
title=${V_("event.where")}
.icon=${"mdi:map-marker-outline"}
></ha-icon>
<span title="${c}">${c}</span>
</div>`:q``}
${l?q` <div>
<ha-icon title=${V_("event.tag")} .icon=${"mdi:tag"}></ha-icon>
<span title="${l}">${l}</span>
</div>`:q``}
${u?q` <div>
<ha-icon
title=${V_("event.seek")}
.icon=${"mdi:clock-fast"}
></ha-icon>
<span title="${u}">${u}</span>
</div>`:q``}
</div>
`}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q`
${this.cameraTitle?q` <div class="title">
<span title="${this.cameraTitle}">${this.cameraTitle}</span>
</div>`:""}
<div class="details">
${t?q` <div>
<ha-icon
title=${V_("recording.start")}
.icon=${"mdi:calendar-clock-outline"}
></ha-icon>
<span title="${t}">${t}</span>
</div>
${a||i?q` <div>
<ha-icon
title=${V_("recording.duration")}
.icon=${"mdi:clock-outline"}
></ha-icon>
${a?q`<span title="${a}">${a}</span>`:""}
${i?q`<span title="${i}">${i}</span>`:""}
</div>`:""}`:""}
${r?q` <div>
<ha-icon
title=${V_("event.seek")}
.icon=${"mdi:clock-fast"}
></ha-icon>
<span title="${r}">${r}</span>
</div>`:q``}
${null!==o?q`<div>
<ha-icon
title=${V_("recording.events")}
.icon=${"mdi:shield-alert"}
></ha-icon>
<span title="${o}">${o}</span>
</div>`:""}
</div>
`}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q`
${tx.isEvent(this.media)&&e?q`<frigate-card-thumbnail-feature-thumbnail
aria-label="${t??""}"
title=${t}
.hass=${this.hass}
.date=${this.media.getStartTime()??void 0}
.thumbnail=${e??void 0}
></frigate-card-thumbnail-feature-thumbnail>`:tx.isEvent(this.media)||tx.isRecording(this.media)?q`<frigate-card-thumbnail-feature-text
aria-label="${t??""}"
title="${t??""}"
.cameraMetadata=${s}
.showCameraTitle=${!this.details}
.date=${this.media.getStartTime()??void 0}
></frigate-card-thumbnail-feature-text>`:q``}
${r?q` <ha-icon
class="${_e(n)}"
icon=${this.media.isFavorite()?"mdi:star":"mdi:star-outline"}
title=${V_("thumbnail.retain_indefinitely")}
@click=${async e=>{if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}}
/></ha-icon>`:""}
${this.details&&tx.isEvent(this.media)?q`<frigate-card-thumbnail-details-event
.media=${this.media??void 0}
.cameraTitle=${s?.title}
.seek=${this.seek}
></frigate-card-thumbnail-details-event>`:this.details&&tx.isRecording(this.media)?q`<frigate-card-thumbnail-details-recording
.media=${this.media??void 0}
.cameraTitle=${s?.title}
.seek=${this.seek}
></frigate-card-thumbnail-details-recording>`:q``}
${a?q`<ha-icon
class="timeline"
icon="mdi:target"
title=${V_("thumbnail.timeline")}
@click=${e=>{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}}
></ha-icon>`:""}
${o?q` <ha-icon
class="download"
icon=${"mdi:download"}
title=${V_("thumbnail.download")}
@click=${async e=>{if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}}
></ha-icon>`:""}
`}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` <frigate-card-thumbnail
class="${_e(r)}"
.cameraManager=${this.cameraManager}
.hass=${this.hass}
.media=${i}
.viewManagerEpoch=${this.viewManagerEpoch}
.seek=${n&&i.includesTime(n)?n:void 0}
?details=${!!this.config?.show_details}
?show_favorite_control=${this.config?.show_favorite_control}
?show_timeline_control=${this.config?.show_timeline_control}
?show_download_control=${this.config?.show_download_control}
@click=${e=>{const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}}
>
</frigate-card-thumbnail>`)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q`<frigate-card-carousel
direction=${e}
.selected=${this._getSelectedSlide()??0}
.dragFree=${!0}
>
${this._thumbnailSlides}
</frigate-card-carousel>`}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='<style>\n:host {\n background-color: #ffffff;\n width: 350px;\n max-width: 75vw;\n\n visibility: hidden;\n transition: visibility 0.5s;\n}\n\n:host([open]) {\n visibility: visible;\n}\n\n::slotted(div) {\n box-sizing: border-box;\n}\n\n#d {\n position: fixed;\n z-index: 99;\n background-color: inherit;\n -webkit-overflow-scrolling: touch;\n overflow: auto;\n overscroll-behavior: contain;\n backdrop-filter: var(--side-drawer-backdrop-filter, none);\n\n top: 0;\n bottom: 0;\n left: 0;\n height: 100%;\n box-sizing: border-box;\n transform: translateX(-100%);\n transition: var(\n --side-drawer-transition,\n transform 0.25s ease-out\n );\n width: inherit;\n max-width: inherit;\n border-top-right-radius: inherit;\n border-bottom-right-radius: inherit;\n}\n\n:host([open]) #d {\n transform: none;\n box-shadow: 0px 0px 25px 0px rgba(0, 0, 0, 0.5);\n}\n\n#fs {\n position: fixed;\n z-index: 98;\n background-color: #000000;\n backdrop-filter: var(--side-drawer-backdrop-filter, none);\n\n top: 0;\n bottom: 0;\n right: -30px; /* hide scrollbar until overscroll bug is fixed */\n height: 100vh;\n transition: var(\n --side-drawer-overlay-transition,\n opacity linear 0.25s\n );\n width: calc(\n 100vw + 30px\n ); /* put back to just 100vw once overscroll bug fixed */\n opacity: 0;\n visibility: hidden;\n\n overflow: auto;\n overscroll-behavior: contain;\n}\n\n:host([open]) #fs {\n opacity: var(--side-drawer-overlay-opacity, 0.7);\n visibility: visible;\n}\n\n/*\n * Workaround for bug https://bugs.chromium.org/p/chromium/issues/detail?id=813094\n * Once bug is fixed and in the wild we can remove this element and make #if overflow:hidden\n * and set "right: 0; width: 100vw" for #fs\n */\n#ifs {\n height: calc(100vh + 1px);\n}\n</style>\n<div id="d"><slot></slot></div>\n<div id="fs"><div id="ifs"></div></div>\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabl
<side-drawer
${je(this._refDrawer)}
location="${this.location}"
?open=${this.open}
@mouseleave=${()=>{this.open&&(this.open=!1)}}
>
${this.control?q`
<div
class="control-surround"
@click=${e=>{wf(e),this.open=!this.open}}
>
<ha-icon
class="control"
icon="${this.open?this.icons?.open??"mdi:menu-open":this.icons?.closed??"mdi:menu"}"
@mouseenter=${()=>{this._isHoverableDevice&&!this.open&&(this.open=!0)}}
>
</ha-icon>
</div>
`:""}
<slot ${je(this._refSlot)} @slotchange=${()=>this._slotChanged()}></slot>
</side-drawer>
`}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` <slot name="above"></slot>
<slot></slot>
<frigate-card-drawer
${je(this._refDrawerLeft)}
location="left"
.icons=${this.drawerIcons?.left}
>
<slot name="left"></slot>
</frigate-card-drawer>
<frigate-card-drawer
${je(this._refDrawerRight)}
location="right"
.icons=${this.drawerIcons?.right}
>
<slot name="right"></slot>
</frigate-card-drawer>
<slot name="below"></slot>`}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-fabd0153.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` <frigate-card-surround-basic
@frigate-card:thumbnails:open=${e=>t(e,"open")}
@frigate-card:thumbnails:close=${e=>t(e,"close")}
>
${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` <frigate-card-thumbnail-carousel
slot=${this.thumbnailConfig.mode}
.hass=${this.hass}
.config=${this.thumbnailConfig}
.cameraManager=${this.cameraManager}
.fadeThumbnails=${e.isViewerView()}
.viewManagerEpoch=${this.viewManagerEpoch}
.selected=${e.queryResults?.getSelectedIndex()??void 0}
@frigate-card:thumbnail-carousel:tap=${e=>{const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}}
>
</frigate-card-thumbnail-carousel>`:""}
${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` <frigate-card-timeline-core
slot=${this.timelineConfig.mode}
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.itemClickAction=${e.isViewerView()||!this.thumbnailConfig||"none"===this.thumbnailConfig?.mode?"play":"select"}
.cameraIDs=${this._cameraIDsForTimeline}
.mini=${!0}
.timelineConfig=${this.timelineConfig}
.thumbnailConfig=${this.thumbnailConfig}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-timeline-core>`:""}
<slot></slot>
</frigate-card-surround-basic>`}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="Wed, 11 Dec 2024 03:36:17 GMT",FE="47fdfbc",VE="Tue, 10 Dec 2024 19:35:09 -0800";const HE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),BE="hass_web_proxy",qE=(e,t)=>`/api/${BE}/v${t??0}/?url=${encodeURIComponent(e)}`,UE=(e,t,n="media")=>(e=>e.config.components.includes(BE))(e)&&!!t[n];async function WE(e,t,n){await e.callService(BE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const ZE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,HE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let QE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.3",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:FE,build_date:NE,commit_date:VE},...e&&{ha_version:e.config.version},integrations:{reolink:await ZE("reolink",e),frigate:{...await ZE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await ZE(BE,e),motioneye:await ZE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([pe()],QE.prototype,"_diagnostics",void 0),QE=e([le("frigate-card-diagnostics")],QE);let GE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-0a012f43.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-c718155d.js"):e?.isViewerView()?import("./index-0197eb89.js"):e?.is("image")?import("./image-cbfd7ccb.js"):e?.is("timeline")&&import("./timeline-62b72e11.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` <frigate-card-surround
class="${_e(n)}"
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.thumbnailConfig=${this.hide?void 0:a}
.timelineConfig=${this.hide?void 0:i}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
${!this.hide&&e?.is("image")&&r?q` <frigate-card-image
.imageConfig=${this.overriddenConfig.image}
.view=${e}
.hass=${this.hass}
.cameraConfig=${r}
.cameraManager=${this.cameraManager}
>
</frigate-card-image>`:""}
${!this.hide&&e?.isGalleryView()?q` <frigate-card-gallery
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.galleryConfig=${this.overriddenConfig.media_gallery}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-gallery>`:""}
${!this.hide&&e?.isViewerView()?q`
<frigate-card-viewer
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.viewerConfig=${this.overriddenConfig.media_viewer}
.resolvedMediaCache=${this.resolvedMediaCache}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-viewer>
`:""}
${!this.hide&&e?.is("timeline")?q` <frigate-card-timeline
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.timelineConfig=${this.overriddenConfig.timeline}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
>
</frigate-card-timeline>`:""}
${!this.hide&&e?.is("diagnostics")?q` <frigate-card-diagnostics
.hass=${this.hass}
.rawConfig=${this.rawConfig}
.deviceRegistryManager=${this.deviceRegistryManager}
>
</frigate-card-diagnostics>`:""}
${this._shouldLivePreload()||!this.hide&&e?.is("live")?q`
<frigate-card-live
.hass=${this.hass}
.viewManagerEpoch=${this.viewManagerEpoch}
.nonOverriddenLiveConfig=${this.nonOverriddenConfig.live}
.overriddenLiveConfig=${this.overriddenConfig.live}
.conditionsManagerEpoch=${this.conditionsManagerEpoch}
.overrides=${this.overriddenConfig.overrides}
.cameraManager=${this.cameraManager}
.cardWideConfig=${this.cardWideConfig}
.microphoneManager=${this.microphoneManager}
.triggeredCameraIDs=${this.triggeredCameraIDs}
class="${_e(t)}"
>
</frigate-card-live>
`:""}
</frigate-card-surround>`}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"cameraManager",void 0),e([he({attribute:!1})],GE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([he({attribute:!1})],GE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],GE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"hide",void 0),e([he({attribute:!1})],GE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],GE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),GE=e([le("frigate-card-views")],GE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.3`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let YE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q`
${r&&s?this._renderMenu(n):""}
${o?this._renderStatusBar(i):""}
${r&&!s?this._renderMenu(n):""}
`};return q`
${"overlay"===e?q`<frigate-card-overlay>${r("overlay")}</frigate-card-overlay>`:q`<div class="outerlay" data-position="${e}">
${r("outerlay")}
</div>`}
`}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q`
<frigate-card-menu
${je(this._refMenu)}
slot=${ve(e)}
.hass=${this._hass}
.menuConfig=${this._config.menu}
.buttons=${this._menuButtonController.calculateButtons(this._hass,this._config,this._controller.getCameraManager(),{inExpandedMode:this._controller.getExpandManager().isExpanded(),inFullscreenMode:this._controller.getFullscreenManager().isInFullscreen(),currentMediaLoadedInfo:this._controller.getMediaLoadedInfoManager().get(),showCameraUIButton:this._controller.getCameraURLManager().hasCameraURL(),mediaPlayerController:this._controller.getMediaPlayerManager(),microphoneManager:this._controller.getMicrophoneManager(),view:t,viewManager:this._controller.getViewManager()})}
.entityRegistryManager=${this._controller.getEntityRegistryManager()}
></frigate-card-menu>
`}_renderStatusBar(e){if(this._config)return q`
<frigate-card-status-bar
slot=${ve(e)}
.items=${this._controller.getStatusBarItemManager().calculateItems({statusConfig:this._config.status_bar,cameraManager:this._controller.getCameraManager(),view:this._controller.getViewManager().getView(),mediaLoadedInfo:this._controller.getMediaLoadedInfoManager().get()})}
.config=${this._config.status_bar}
></frigate-card-status-bar>
`}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` <web-dialog
open
center
@close=${()=>{this._controller.getExpandManager().setExpanded(!1)}}
>
${e}
</web-dialog>`:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` <ha-card
id="ha-card"
.actionHandler=${kf({hasHold:bf(t.hold_action),hasDoubleClick:bf(t.double_tap_action)})}
style="${Re(this._controller.getStyleManager().getAspectRatioStyle())}"
@frigate-card:message=${e=>this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)}
@frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)}
@frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()}
@frigate-card:media:volumechange=${()=>this.requestUpdate()}
@frigate-card:media:play=${()=>this.requestUpdate()}
@frigate-card:media:pause=${()=>this.requestUpdate()}
@frigate-card:focus=${()=>this.focus()}
>
${a?q`<frigate-card-loading></frigate-card-loading>`:""}
${this._renderMenuStatusContainer("top")}
${this._renderMenuStatusContainer("overlay")}
<div ${je(this._refMain)} class="${_e(e)}">
<frigate-card-views
${je(this._refViews)}
.hass=${this._hass}
.viewManagerEpoch=${this._controller.getViewManager().getEpoch()}
.cameraManager=${n}
.resolvedMediaCache=${this._controller.getResolvedMediaCache()}
.nonOverriddenConfig=${this._controller.getConfigManager().getNonOverriddenConfig()}
.overriddenConfig=${this._controller.getConfigManager().getConfig()}
.cardWideConfig=${this._controller.getConfigManager().getCardWideConfig()}
.rawConfig=${this._controller.getConfigManager().getRawConfig()}
.configManager=${this._controller.getConfigManager()}
.conditionsManagerEpoch=${this._controller.getConditionsManager()?.getEpoch()}
.hide=${!!this._controller.getMessageManager().hasMessage()}
.microphoneManager=${this._controller.getMicrophoneManager()}
.triggeredCameraIDs=${this._config?.view.triggers.show_trigger_status?this._controller.getTriggersManager().getTriggeredCameraIDs():void 0}
.deviceRegistryManager=${this._controller.getDeviceRegistryManager()}
></frigate-card-views>
${wk(this._controller.getMessageManager().getMessage())}
</div>
${this._renderMenuStatusContainer("bottom")}
${this._config?.elements?q` <frigate-card-elements
${je(this._refElements)}
.hass=${this._hass}
.elements=${this._config?.elements}
.conditionsManagerEpoch=${this._controller.getConditionsManager()?.getEpoch()}
@frigate-card:menu:add=${e=>{this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}}
@frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}}
@frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}}
@frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}}
@frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}}
>
</frigate-card-elements>`:""}
</ha-card>`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};YE=e([le("frigate-card")],YE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo a