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

651 lines
518 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4");
/**
* @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=>D(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a<t.length&&(this._$AR(n&&n._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,a,i){this.type=1,this._$AH=W,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o<i.length-1;o++)s=X(this,a[n+o],t,o),s===U&&(s=this._$AH[o]),r||=!O(s)||s!==this._$AH[o],s===W?e=W:e!==W&&(e+=(s??"")+i[o+1]),this._$AH[o]=s}r&&!a&&this.j(e)}j(e){e===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ne extends te{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===W?void 0:e}}class ae extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==W)}}class ie extends te{constructor(e,t,n,a,i){super(e,t,n,a,i),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??W)===U)return;const n=this._$AH,a=e===W&&n!==W||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==W&&(n===W||a);a&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}let re=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){X(this,e)}};const oe=k.litHtmlPolyfillSupport;oe?.(K,ee),(k.litHtmlVersions??=[]).push("3.1.2");
/**
* @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-behavior:contain;-webkit-overflow-scrolling:touch}:host([center]){display:flex;align-items:center;justify-content:center;overflow:hidden}:host([center]) #dialog{max-height:var(--dialog-max-height,100%)}:host(:not(:defined)),:host(:not([open])){display:none}#backdrop{background:var(--dialog-backdrop-bg,rgba(0,0,0,.6));animation:fadeIn var(--dialog-animation-duration,.1s) var(--dialog-animation-easing,ease-out);z-index:-1}#dialog{animation:scaleIn var(--dialog-animation-duration,.1s) var(--dialog-animation-easing,ease-out);border-radius:var(--dialog-border-radius,12px);box-shadow:var(--dialog-box-shadow,0 2px 10px -5px rgba(0,0,0,.6));max-width:var(--dialog-max-width,700px);width:var(--dialog-width,100%);padding:var(--dialog-padding,24px);max-height:var(--dialog-max-height,unset);height:var(--dialog-height,auto);color:var(--dialog-color,currentColor);background:var(--dialog-bg,#fff);z-index:1;position:relative;display:flex;flex-direction:column;margin:0 auto;border:none}::slotted(article),article{flex-grow:1;overflow-y:auto;-webkit-overflow-scrolling:touch}::slotted(footer),::slotted(header),footer,header{flex-shrink:0}@keyframes scaleIn{0%{transform:scale(.9) translateY(30px);opacity:0}to{transform:scale(1) translateY(0);opacity:1}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}</style>\n <div id="backdrop" part="backdrop"></div>\n <focus-trap id="dialog" part="dialog">\n <slot></slot>\n </focus-trap>\n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;a<i.path.length;){const n=i.path[a];a===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(e){if(!(e instanceof st))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ke.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.length<a.value;(i||r)&&(n=this._getOrReturnCtx(e,n),i?ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):r&&ht(n,{code:ot.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"email",code:ot.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Pt||(Pt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"emoji",code:ot.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)jt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"uuid",code:ot.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"nanoid",code:ot.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)zt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"cuid",code:ot.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)It.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"cuid2",code:ot.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"ulid",code:ot.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(i){n=this._getOrReturnCtx(e,n),ht(n,{validation:"url",code:ot.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"regex",code:ot.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){qt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){Ht.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){new RegExp(`^${Bt(a)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"duration",code:ot.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?Ut(e.data,a.version)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"ip",code:ot.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),ht(n,{validation:"base64",code:ot.invalid_string,message:a.message}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Zt(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=n>a?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Qt.create=e=>new Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Gt.create=e=>{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Kt.create=e=>new Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(ht(t,{code:e?ot.too_big:ot.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(ht(t,{code:ot.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const i=hn(e[a],t[a]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===it.date&&a===it.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class pn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.length<this._def.items.length)return ht(n,{code:ot.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mt;!this._def.rest&&n.data.length>this._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(ht(n,{code:ot.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n<e.length;n++){const a=e[n];"number"==typeof a?t+="["+a+"]":t?t+=" -> "+a:t=a}return t},Ns=ba.object({key:ba.string(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),Fs={enabled:!0,ptz_left:{key:"ArrowLeft"},ptz_right:{key:"ArrowRight"},ptz_up:{key:"ArrowUp"},ptz_down:{key:"ArrowDown"},ptz_zoom_in:{key:"+"},ptz_zoom_out:{key:"-"},ptz_home:{key:"h"}},Vs=ba.object({enabled:ba.boolean().default(Fs.enabled),ptz_left:Ns.nullable().default(Fs.ptz_left),ptz_right:Ns.nullable().default(Fs.ptz_right),ptz_up:Ns.nullable().default(Fs.ptz_up),ptz_down:Ns.nullable().default(Fs.ptz_down),ptz_zoom_in:Ns.nullable().default(Fs.ptz_zoom_in),ptz_zoom_out:Ns.nullable().default(Fs.ptz_zoom_out),ptz_home:Ns.nullable().default(Fs.ptz_home)}),Hs=[...["left","right","up","down","zoom_in","zoom_out"],"preset"],Bs=20,qs=20,Us=100,Ws=Us,Zs=["diagnostics","live","clip","clips","snapshot","snapshots","recording","recordings","image","timeline"],Qs="live",Gs=["unselected","hidden"],Ys=["selected","visible"],Ks=[...Ys,"microphone"],Xs=[...Gs,"microphone"],Js=["start","stop"],ec=["events","clips","snapshots"],tc=/^[-\w]+$/,nc=ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}),ac=ba.number().min(1).max(10),ic=ba.enum(["single","grid"]),rc=ba.object({mode:ic,grid_selected_width_factor:ba.number().min(0).optional(),grid_max_columns:ba.number().min(0).optional(),grid_columns:ba.number().min(0).optional()}).optional(),oc=ba.object({confirmation:ba.boolean().or(ba.object({text:ba.string().optional(),exemptions:ba.object({user:ba.string()}).array().optional()})).optional()}),sc=oc.extend({action:ba.literal("toggle")}),cc=ba.object({entity_id:ba.string().optional(),device_id:ba.string().optional(),area_id:ba.string().optional()}),lc=oc.extend({action:ba.literal("perform-action"),perform_action:ba.string(),data:ba.object({}).passthrough().optional(),target:cc.optional()}),dc=oc.extend({action:ba.literal("call-service"),service:ba.string(),data:ba.object({}).passthrough().optional(),target:cc.optional()}),uc=oc.extend({action:ba.literal("navigate"),navigation_path:ba.string()}),hc=oc.extend({action:ba.literal("url"),url_path:ba.string()}),pc=oc.extend({action:ba.literal("more-info")}),mc=oc.extend({action:ba.literal("fire-dom-event")}).passthrough(),gc=oc.extend({action:ba.literal("none")}),fc=mc.extend({action:ba.literal("custom:frigate-card-action").transform((()=>"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r<a?7:0)+r-a;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function eu(e){return Jd(e,{weekStartsOn:1})}function tu(e){const t=Vd(e),n=t.getFullYear(),a=Hd(e,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const i=eu(a),r=Hd(e,0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);const o=eu(r);return t.getTime()>=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(s,(e=>e.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}Xu.prototype.clear=function(){this.__data__=[],this.size=0},Xu.prototype.delete=function(e){var t=this.__data__,n=Yu(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ku.call(t,n,1),--this.size,!0)},Xu.prototype.get=function(e){var t=this.__data__,n=Yu(t,e);return n<0?void 0:t[n][1]},Xu.prototype.has=function(e){return Yu(this.__data__,e)>-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}function Rh(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Ph(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}Dh.prototype.clear=function(){this.__data__=Th?Th(null):{},this.size=0},Dh.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Dh.prototype.get=function(e){var t=this.__data__;if(Th){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return jh.call(t,e)?t[e]:void 0},Dh.prototype.has=function(e){var t=this.__data__;return Th?void 0!==t[e]:Oh.call(t,e)},Dh.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Th&&void 0===t?"__lodash_hash_undefined__":t,this},Ph.prototype.clear=function(){this.size=0,this.__data__={hash:new Dh,map:new(Ih||Xu),string:new Dh}},Ph.prototype.delete=function(e){var t=Rh(this,e).delete(e);return this.size-=t?1:0,t},Ph.prototype.get=function(e){return Rh(this,e).get(e)},Ph.prototype.has=function(e){return Rh(this,e).has(e)},Ph.prototype.set=function(e,t){var n=Rh(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this};function Lh(e){var t=this.__data__=new Xu(e);this.size=t.size}Lh.prototype.clear=function(){this.__data__=new Xu,this.size=0},Lh.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Lh.prototype.get=function(e){return this.__data__.get(e)},Lh.prototype.has=function(e){return this.__data__.has(e)},Lh.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Xu){var a=n.__data__;if(!Ih||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ph(a)}return n.set(e,t),this.size=n.size,this};function Nh(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Ph;++t<n;)this.add(e[t])}function Fh(e,t){for(var n=-1,a=null==e?0:e.length;++n<a;)if(t(e[n],n,e))return!0;return!1}function Vh(e,t){return e.has(t)}Nh.prototype.add=Nh.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Nh.prototype.has=function(e){return this.__data__.has(e)};var Hh=1,Bh=2;function qh(e,t,n,a,i,r){var o=n&Hh,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u<s;){var m=e[u],g=t[u];if(a)var f=o?a(g,m,u,t,e,r):a(m,g,u,e,t,r);if(void 0!==f){if(f)continue;h=!1;break}if(p){if(!Fh(t,(function(e,t){if(!Vh(p,t)&&(m===e||i(m,e,n,a,r)))return p.push(t)}))){h=!1;break}}else if(m!==g&&!i(m,g,n,a,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Uh=th.Uint8Array;function Wh(e){var t=-1,n=Array(e.size);return e.forEach((function(e,a){n[++t]=[a,e]})),n}function Zh(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Qh=1,Gh=2,Yh="[object Boolean]",Kh="[object Date]",Xh="[object Error]",Jh="[object Map]",ep="[object Number]",tp="[object RegExp]",np="[object Set]",ap="[object String]",ip="[object Symbol]",rp="[object ArrayBuffer]",op="[object DataView]",sp=nh?nh.prototype:void 0,cp=sp?sp.valueOf:void 0;function lp(e,t){for(var n=-1,a=t.length,i=e.length;++n<a;)e[i+n]=t[n];return e}var dp=Array.isArray;function up(e,t,n){var a=t(e);return dp(e)?a:lp(a,n(e))}function hp(){return[]}var pp=Object.prototype.propertyIsEnumerable,mp=Object.getOwnPropertySymbols,gp=mp?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,a=null==e?0:e.length,i=0,r=[];++n<a;){var o=e[n];t(o,n,e)&&(r[i++]=o)}return r}(mp(e),(function(t){return pp.call(e,t)})))}:hp;function fp(e){return null!=e&&"object"==typeof e}function _p(e){return fp(e)&&"[object Arguments]"==uh(e)}var vp=Object.prototype,yp=vp.hasOwnProperty,bp=vp.propertyIsEnumerable,wp=_p(function(){return arguments}())?_p:function(e){return fp(e)&&yp.call(e,"callee")&&!bp.call(e,"callee")};var xp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Cp=xp&&"object"==typeof module&&module&&!module.nodeType&&module,Mp=Cp&&Cp.exports===xp?th.Buffer:void 0,kp=(Mp?Mp.isBuffer:void 0)||function(){return!1},Sp=9007199254740991,Ep=/^(?:0|[1-9]\d*)$/;function $p(e,t){var n=typeof e;return!!(t=null==t?Sp:t)&&("number"==n||"symbol"!=n&&Ep.test(e))&&e>-1&&e%1==0&&e<t}var Ap=9007199254740991;function zp(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n<e;)a[n]=t(n);return a}(e.length,String):[],c=s.length;for(var l in e)!t&&!Fp.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||$p(l,c))||s.push(l);return s}var Hp=Object.prototype;function Bp(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Hp)}function qp(e,t){return function(n){return e(t(n))}}var Up=qp(Object.keys,Object),Wp=Object.prototype.hasOwnProperty;function Zp(e){return null!=e&&zp(e.length)&&!_h(e)}function Qp(e){return Zp(e)?Vp(e):function(e){if(!Bp(e))return Up(e);var t=[];for(var n in Object(e))Wp.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}function Gp(e){return up(e,Qp,gp)}var Yp=1,Kp=Object.prototype.hasOwnProperty;var Xp=zh(th,"DataView"),Jp=zh(th,"Promise"),em=zh(th,"Set"),tm=zh(th,"WeakMap"),nm="[object Map]",am="[object Promise]",im="[object Set]",rm="[object WeakMap]",om="[object DataView]",sm=xh(Xp),cm=xh(Ih),lm=xh(Jp),dm=xh(em),um=xh(tm),hm=uh;(Xp&&hm(new Xp(new ArrayBuffer(1)))!=om||Ih&&hm(new Ih)!=nm||Jp&&hm(Jp.resolve())!=am||em&&hm(new em)!=im||tm&&hm(new tm)!=rm)&&(hm=function(e){var t=uh(e),n="[object Object]"==t?e.constructor:void 0,a=n?xh(n):"";if(a)switch(a){case sm:return om;case cm:return nm;case lm:return am;case dm:return im;case um:return rm}return t});var pm=hm,mm=1,gm="[object Arguments]",fm="[object Array]",_m="[object Object]",vm=Object.prototype.hasOwnProperty;function ym(e,t,n,a,i,r){var o=dp(e),s=dp(t),c=o?fm:pm(e),l=s?fm:pm(t),d=(c=c==gm?_m:c)==_m,u=(l=l==gm?_m:l)==_m,h=c==l;if(h&&kp(e)){if(!kp(t))return!1;o=!0,d=!1}if(h&&!d)return r||(r=new Lh),o||Np(e)?qh(e,t,n,a,i,r):function(e,t,n,a,i,r,o){switch(n){case op:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rp:return!(e.byteLength!=t.byteLength||!r(new Uh(e),new Uh(t)));case Yh:case Kh:case ep:return Gu(+e,+t);case Xh:return e.name==t.name&&e.message==t.message;case tp:case ap:return e==t+"";case Jh:var s=Wh;case np:var c=a&Qh;if(s||(s=Zh),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;a|=Gh,o.set(e,t);var d=qh(s(e),s(t),a,i,r,o);return o.delete(e),d;case ip:if(cp)return cp.call(e)==cp.call(t)}return!1}(e,t,c,n,a,i,r);if(!(n&mm)){var p=d&&vm.call(e,"__wrapped__"),m=u&&vm.call(t,"__wrapped__");if(p||m){var g=p?e.value():e,f=m?t.value():t;return r||(r=new Lh),i(g,f,n,a,r)}}return!!h&&(r||(r=new Lh),function(e,t,n,a,i,r){var o=n&Yp,s=Gp(e),c=s.length;if(c!=Gp(t).length&&!o)return!1;for(var l=c;l--;){var d=s[l];if(!(o?d in t:Kp.call(t,d)))return!1}var u=r.get(e),h=r.get(t);if(u&&h)return u==t&&h==e;var p=!0;r.set(e,t),r.set(t,e);for(var m=o;++l<c;){var g=e[d=s[l]],f=t[d];if(a)var _=o?a(f,g,d,t,e,r):a(g,f,d,e,t,r);if(!(void 0===_?g===f||i(g,f,n,a,r):_)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(p=!1)}return r.delete(e),r.delete(t),p}(e,t,n,a,i,r))}function bm(e,t,n,a,i){return e===t||(null==e||null==t||!fp(e)&&!fp(t)?e!=e&&t!=t:ym(e,t,n,a,bm,i))}var wm=function(){try{var e=zh(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),xm=wm;function Cm(e,t,n){"__proto__"==t&&xm?xm(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Mm(e,t,n){(void 0!==n&&!Gu(e[t],n)||void 0===n&&!(t in e))&&Cm(e,t,n)}var km,Sm=function(e,t,n){for(var a=-1,i=Object(e),r=n(e),o=r.length;o--;){var s=r[km?o:++a];if(!1===t(i[s],s,i))break}return e},Em="object"==typeof exports&&exports&&!exports.nodeType&&exports,$m=Em&&"object"==typeof module&&module&&!module.nodeType&&module,Am=$m&&$m.exports===Em?th.Buffer:void 0,zm=Am?Am.allocUnsafe:void 0;function Im(e,t){if(t)return e.slice();var n=e.length,a=zm?zm(n):new e.constructor(n);return e.copy(a),a}function Tm(e){var t=new e.constructor(e.byteLength);return new Uh(t).set(new Uh(e)),t}function jm(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Om(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}var Dm=Object.create,Rm=function(){function e(){}return function(t){if(!hh(t))return{};if(Dm)return Dm(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Pm=qp(Object.getPrototypeOf,Object);function Lm(e){return"function"!=typeof e.constructor||Bp(e)?{}:Rm(Pm(e))}var Nm="[object Object]",Fm=Function.prototype,Vm=Object.prototype,Hm=Fm.toString,Bm=Vm.hasOwnProperty,qm=Hm.call(Object);function Um(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Wm=Object.prototype.hasOwnProperty;function Zm(e,t,n){var a=e[t];Wm.call(e,t)&&Gu(a,n)&&(void 0!==n||t in e)||Cm(e,t,n)}function Qm(e,t,n,a){var i=!n;n||(n={});for(var r=-1,o=t.length;++r<o;){var s=t[r],c=a?a(n[s],e[s],s,n,e):void 0;void 0===c&&(c=e[s]),i?Cm(n,s,c):Zm(n,s,c)}return n}var Gm=Object.prototype.hasOwnProperty;function Ym(e){if(!hh(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Bp(e),n=[];for(var a in e)("constructor"!=a||!t&&Gm.call(e,a))&&n.push(a);return n}function Km(e){return Zp(e)?Vp(e,!0):Ym(e)}function Xm(e,t,n,a,i,r,o){var s=Um(e,n),c=Um(t,n),l=o.get(c);if(l)Mm(e,n,l);else{var d,u=r?r(s,c,n+"",e,t,o):void 0,h=void 0===u;if(h){var p=dp(c),m=!p&&kp(c),g=!p&&!m&&Np(c);u=c,p||m||g?dp(s)?u=s:fp(d=s)&&Zp(d)?u=Om(s):m?(h=!1,u=Im(c,!0)):g?(h=!1,u=jm(c,!0)):u=[]:function(e){if(!fp(e)||uh(e)!=Nm)return!1;var t=Pm(e);if(null===t)return!0;var n=Bm.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Hm.call(n)==qm}(c)||wp(c)?(u=s,wp(s)?u=function(e){return Qm(e,Km(e))}(s):hh(s)&&!_h(s)||(u=Lm(c))):h=!1}h&&(o.set(c,u),i(u,c,a,r,o),o.delete(c)),Mm(e,n,u)}}function Jm(e,t,n,a,i){e!==t&&Sm(t,(function(r,o){if(i||(i=new Lh),hh(r))Xm(e,t,o,n,Jm,a,i);else{var s=a?a(Um(e,o),r,o+"",e,t,i):void 0;void 0===s&&(s=r),Mm(e,o,s)}}),Km)}function eg(e){return e}var tg=Math.max;var ng=xm?function(e,t){return xm(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:eg,ag=ng,ig=Date.now;var rg,og,sg,cg=(rg=ag,og=0,sg=0,function(){var e=ig(),t=16-(e-sg);if(sg=e,t>0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i<r;)o[i]=a[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=a[i];return s[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,eg),e+"")}function dg(e,t,n){if(!hh(n))return!1;var a=typeof t;return!!("number"==a?Zp(n)&&$p(t,n.length):"string"==a&&t in n)&&Gu(n[t],e)}function ug(e){return lg((function(t,n){var a=-1,i=n.length,r=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a<i;){var s=n[a];s&&e(t,s,a,r)}return t}))}var hg=ug((function(e,t,n,a){Jm(e,t,n,a)})),pg=/\s/;var mg=/^\s+/;function gg(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&pg.test(e.charAt(t)););return t}(e)+1).replace(mg,""):e}var fg="[object Symbol]";function _g(e){return"symbol"==typeof e||fp(e)&&uh(e)==fg}var vg=NaN,yg=/^[-+]0x[0-9a-f]+$/i,bg=/^0b[01]+$/i,wg=/^0o[0-7]+$/i,xg=parseInt;function Cg(e){if("number"==typeof e)return e;if(_g(e))return vg;if(hh(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=hh(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=gg(e);var n=bg.test(e);return n||wg.test(e)?xg(e.slice(2),n?2:8):yg.test(e)?vg:+e}var Mg=1/0,kg=17976931348623157e292;function Sg(e){var t=function(e){return e?(e=Cg(e))===Mg||e===-Mg?(e<0?-1:1)*kg:e==e?e:0:0===e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}function Eg(e,t){for(var n=-1,a=null==e?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}var $g=1/0,Ag=nh?nh.prototype:void 0,zg=Ag?Ag.toString:void 0;function Ig(e){if("string"==typeof e)return e;if(dp(e))return Eg(e,Ig)+"";if(_g(e))return zg?zg.call(e):"";var t=e+"";return"0"==t&&1/e==-$g?"-0":t}function Tg(e){return null==e?"":Ig(e)}var jg=th.isFinite,Og=Math.min;var Dg=function(e){var t=Math[e];return function(e,n){if(e=Cg(e),(n=null==n?0:Og(Sg(n),292))&&jg(e)){var a=(Tg(e)+"e").split("e");return+((a=(Tg(t(a[0]+"e"+(+a[1]+n)))+"e").split("e"))[0]+"e"+(+a[1]-n))}return t(e)}}("round"),Rg=Dg;function Pg(e){return e!=e}function Lg(e,t){return!!(null==e?0:e.length)&&function(e,t,n){return t==t?function(e,t,n){for(var a=n-1,i=e.length;++a<i;)if(e[a]===t)return a;return-1}(e,t,n):function(e,t,n,a){for(var i=e.length,r=n+(a?1:-1);a?r--:++r<i;)if(t(e[r],r,e))return r;return-1}(e,Pg,n)}(e,t,0)>-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a<i;)if(n(t,e[a]))return!0;return!1}var Fg=em&&1/Zh(new em([,-0]))[1]==1/0?function(e){return new em(e)}:function(){},Vg=200;function Hg(e,t,n){var a=-1,i=Lg,r=e.length,o=!0,s=[],c=s;if(n)o=!1,i=Ng;else if(r>=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++a<r;){var d=e[a],u=t?t(d):d;if(d=n||0!==d?d:0,o&&u==u){for(var h=c.length;h--;)if(c[h]===u)continue e;t&&c.push(u),s.push(d)}else i(c,u,n)||(c!==s&&c.push(u),s.push(d))}return s}function Bg(e,t,n){e.dispatchEvent(new CustomEvent(`frigate-card:${t}`,{bubbles:!0,composed:!0,detail:n}))}function qg(e){if(!e)return;return e.split(/[_\s]+/).map((e=>e[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++n<a&&!1!==t(e[n],n,e););}(m||e,(function(a,i){m&&(a=e[i=a]),Zm(o,i,d_(a,t,n,i,e,r))})),o}l_[r_]=l_["[object Array]"]=l_["[object ArrayBuffer]"]=l_["[object DataView]"]=l_["[object Boolean]"]=l_["[object Date]"]=l_["[object Float32Array]"]=l_["[object Float64Array]"]=l_["[object Int8Array]"]=l_["[object Int16Array]"]=l_["[object Int32Array]"]=l_["[object Map]"]=l_["[object Number]"]=l_[c_]=l_["[object RegExp]"]=l_["[object Set]"]=l_["[object String]"]=l_["[object Symbol]"]=l_["[object Uint8Array]"]=l_["[object Uint8ClampedArray]"]=l_["[object Uint16Array]"]=l_["[object Uint32Array]"]=!0,l_["[object Error]"]=l_[o_]=l_["[object WeakMap]"]=!1;function u_(e){return d_(e,5)}var h_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var m_={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function a(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,a,r,o){if("function"!=typeof a)throw new TypeError("The listener must be a function");var s=new i(a,r||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function s(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,a,i=[];if(0===this._eventsCount)return i;for(a in e=this._events)t.call(e,a)&&i.push(n?a.slice(1):a);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,a=this._events[t];if(!a)return[];if(a.fn)return[a.fn];for(var i=0,r=a.length,o=new Array(r);i<r;i++)o[i]=a[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,a=this._events[t];return a?a.fn?1:a.length:0},s.prototype.emit=function(e,t,a,i,r,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,a),!0;case 4:return d.fn.call(d.context,t,a,i),!0;case 5:return d.fn.call(d.context,t,a,i,r),!0;case 6:return d.fn.call(d.context,t,a,i,r,o),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,a);break;case 4:d[l].fn.call(d[l].context,t,a,i);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,a,i){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return o(this,r),this;var s=this._events[r];if(s.fn)s.fn!==t||i&&!s.once||a&&s.context!==a||o(this,r);else{for(var c=0,l=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||a&&s[c].context!==a)&&l.push(s[c]);l.length?this._events[r]=1===l.length?l[0]:l:o(this,r)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new a,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(m_);var g_=p_(m_.exports);class f_ extends Error{constructor(e){super(e),this.name="TimeoutError"}}class __ extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const v_=e=>void 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a<this.#i}get#g(){return this.#d<this.#u}#f(){this.#d--,this.#_(),this.emit("next")}#v(){this.#y(),this.#b(),this.#c=void 0}get#w(){const e=Date.now();if(void 0===this.#s){const t=this.#o-e;if(!(t<0))return void 0===this.#c&&(this.#c=setTimeout((()=>{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.size<e||await this.#M("next",(()=>this.#e.size<e))}async onIdle(){0===this.#d&&0===this.#e.size||await this.#M("idle")}async#M(e,t){return new Promise((n=>{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++a<i;)r[a]=e[a+t];return r}var Y_=Math.ceil,K_=Math.max;var X_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J_=/^\w*$/;function ev(e,t){if(dp(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!_g(e))||(J_.test(e)||!X_.test(e)||null!=t&&e in Object(t))}var tv="Expected a function";function nv(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(tv);var n=function(){var a=arguments,i=t?t.apply(this,a):a[0],r=n.cache;if(r.has(i))return r.get(i);var o=e.apply(this,a);return n.cache=r.set(i,o)||r,o};return n.cache=new(nv.Cache||Ph),n}nv.Cache=Ph;var av=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,iv=/\\(\\)?/g,rv=function(e){var t=nv(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(av,(function(e,n,a,i){t.push(a?i.replace(iv,"$1"):n||e)})),t})),ov=rv;function sv(e,t){return dp(e)?e:ev(e,t)?[e]:ov(Tg(e))}var cv=1/0;function lv(e){if("string"==typeof e||_g(e))return e;var t=e+"";return"0"==t&&1/e==-cv?"-0":t}function dv(e,t){for(var n=0,a=(t=sv(t,e)).length;null!=e&&n<a;)e=e[lv(t[n++])];return n&&n==a?e:void 0}var uv=1,hv=2;function pv(e){return e==e&&!hh(e)}function mv(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function gv(e){var t=function(e){for(var t=Qp(e),n=t.length;n--;){var a=t[n],i=e[a];t[n]=[a,i,pv(i)]}return t}(e);return 1==t.length&&t[0][2]?mv(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,a){var i=n.length,r=i,o=!a;if(null==e)return!r;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<r;){var c=(s=n[i])[0],l=e[c],d=s[1];if(o&&s[2]){if(void 0===l&&!(c in e))return!1}else{var u=new Lh;if(a)var h=a(l,d,c,e,t,u);if(!(void 0===h?bm(d,l,uv|hv,a,u):h))return!1}}return!0}(n,e,t)}}function fv(e,t,n){var a=null==e?void 0:dv(e,t);return void 0===a?n:a}function _v(e,t){return null!=e&&t in Object(e)}function vv(e,t){return null!=e&&function(e,t,n){for(var a=-1,i=(t=sv(t,e)).length,r=!1;++a<i;){var o=lv(t[a]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++a!=i?r:!!(i=null==e?0:e.length)&&zp(i)&&$p(o,i)&&(dp(e)||wp(e))}(e,t,_v)}var yv=1,bv=2;function wv(e){return ev(e)?(t=lv(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return dv(t,e)}}(e);var t}function xv(e){return"function"==typeof e?e:null==e?eg:"object"==typeof e?dp(e)?(t=e[0],n=e[1],ev(t)&&pv(n)?mv(lv(t),n):function(e){var a=fv(e,t);return void 0===a&&a===n?vv(e,t):bm(n,a,yv|bv)}):gv(e):wv(e);var t,n}var Cv=function(e,t){return function(n,a){if(null==n)return n;if(!Zp(n))return e(n,a);for(var i=n.length,r=t?i:-1,o=Object(n);(t?r--:++r<i)&&!1!==a(o[r],r,o););return n}}((function(e,t){return e&&Sm(e,t,Qp)})),Mv=Cv;function kv(e,t){if(e!==t){var n=void 0!==e,a=null===e,i=e==e,r=_g(e),o=void 0!==t,s=null===t,c=t==t,l=_g(t);if(!s&&!l&&!r&&e>t||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e<t||l&&n&&i&&!a&&!r||s&&n&&i||!o&&i||!c)return-1}return 0}function Sv(e,t,n){t=t.length?Eg(t,(function(e){return dp(e)?function(t){return dv(t,1===e.length?e[0]:e)}:e})):[eg];var a=-1;t=Eg(t,Tp(xv));var i=function(e,t){var n=-1,a=Zp(e)?Array(e.length):[];return Mv(e,(function(e,i,r){a[++n]=t(e,i,r)})),a}(e,(function(e,n,i){return{criteria:Eg(t,(function(t){return t(e)})),index:++a,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,(function(e,t){return function(e,t,n){for(var a=-1,i=e.criteria,r=t.criteria,o=i.length,s=n.length;++a<o;){var c=kv(i[a],r[a]);if(c)return a>=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));i<a;)o[r++]=G_(e,i,i+=t);return o}(t.targets,t.concurrency??1/0)){const r=await tf(i,(async a=>await this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++n<a;){var o=e[n],s=t?t(o):o;if(!n||!Gu(s,c)){var c=s;r[i++]=0===o?0:o}}return r}(e,xv(t)):[]}class Pv{constructor(e){this._ranges=e??[]}hasCoverage(e){return this._ranges.some((t=>Nv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>t<n.expires&&Nv(n,e)))}add(e){this._ranges.push(e),this._expireOldRanges()}_expireOldRanges(){const e=new Date;this._ranges=this._ranges.filter((t=>e<t.expires))}clear(){this._ranges=[]}}const Nv=(e,t)=>t.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e<t.expires))}}class Bv extends Hv{}class qv{constructor(e,t){this._ranges=new Pv,this._data=[],this._timeFunc=e,this._idFunc=t}add(e,t){this._ranges.add(e),this._data=Rv(Ev(this._data.concat(t),this._timeFunc,"asc"),this._idFunc)}hasCoverage(e){return this._ranges.hasCoverage(e)}get(e){if(!this.hasCoverage(e))return null;const t=[];for(const n of this._data){const a=this._timeFunc(n);if(a>=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-458c9005.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-7cd5392b.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-3521f17f.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-c0a1587c.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS();
/* 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)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n):
/* 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"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)}
/* 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=()=>!!navigator.userAgent.match(/CrKey\//),yb=(e,t)=>!!((e.attributes.supported_features??0)&t),bb=e=>(e=>yb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,wb=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"}},xb=(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"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},Cb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Mb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},kb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Sb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Eb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Sb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":kb[a]},$b=e=>{const t=e?.attributes.device_class;if(t&&t in Mb)return Mb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Eb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Ab="mdi:bookmark",zb={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ib(e,t,n,a){switch(e){case"alarm_control_panel":return wb(n);case"binary_sensor":return xb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return Cb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=$b(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?zb[e]:"mdi:weather-night";case"update":return"on"===t?.state?bb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in zb?zb[e]:a??Ab}async function Tb(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function jb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Ob(e,t,n,a){return!!jb(e,t,n,{...a,firstOnly:!0}).length}function Db(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Rb(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Pb(e){return{color:Rb(e),filter:Db(e)}}function Lb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Pb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Fb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Nb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Fb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ib(Ye(t),a,a?.state,n)}const Vb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Hb=e=>!!e&&["on","open"].includes(e),Bb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function qb(e){return!!e?.startsWith("/")}function Ub(e,t){return qb(t)?e.hassUrl(t):t??null}class Wb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Zb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Zb||(Zb={}));class Qb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Wb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Zb.LANGUAGES,Zb.SIDE_LOAD_ELEMENTS,Zb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Zb.MICROPHONE_CONNECT]:[],Zb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Zb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Zb.SIDE_LOAD_ELEMENTS]:async()=>await Vb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Zb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Zb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Zb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Gb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,vb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),of(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Zb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Yb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i<r;){var c=lv(t[i]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=o){var d=s[c];void 0===(l=a?a(d,c,s):void 0)&&(l=hh(d)?d:$p(t[i+1])?[]:{})}Zm(s,c,l),s=s[c]}return e}(e,t,n)}function Kb(e,t){return null==(e=function(e,t){return t.length<2?e:dv(e,G_(t,0,-1))}(e,t=sv(t,e)))||delete e[lv((n=t,a=null==n?0:n.length,a?n[a-1]:void 0))];var n,a}const Xb=(e,t,n)=>{Yb(e,t,n)},Jb=(e,t,n)=>fv(e,t,n),ew=(e,t)=>{!function(e,t){null==e||Kb(e,t)}(e,t)},tw=e=>u_(e),nw=(e,t)=>e.replace("#",`[${t.toString()}]`),aw=function(e){let t=!1;for(let n=0;n<fw.length;n++)t=fw[n](e)||t;return t},iw=function(e){return aw(tw(e))},rw=function(e,t,n){return function(a){return((e,t,n,a)=>{const i=Jb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(ew(e,t),0):void 0===r||(a?.keepOriginal||ew(e,t),Xb(e,n,r),0)))})(a,e,t,n)}},ow=function(e,t,n){return function(a){let i=rw(e,t,n)(a);return i=lw(bs,rw(e,t,n),(e=>e.overrides))(a)||i,i}},sw=function(e,t){return ow(e,e,{transform:t})},cw=function(e){return ow(e,e,{transform:e=>null})},lw=function(e,t,n){return function(a){let i=!1;const r=Jb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},dw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},uw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),hw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),mw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),gw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),fw=[lw(bs,uw,(e=>e.conditions)),e=>dw(uw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),ow("event_gallery",or),ow("menu.buttons.frigate_ui",is),e=>dw(gw)("object"==typeof e&&e?e:{}),lw(Ca,sw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),ow("live.jsmpeg",ki),ow("live.image",Ci),ow("live.webrtc_card",Si),lw(Ca,ow("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),lw(Ca,ow("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>dw(mw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Yb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},ow("view.timeout_seconds",Ri),sw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),sw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),ow("live.controls.thumbnails.media",io),ow("timeline.media",Ho),ow("live.controls.timeline.media",po),ow("media_viewer.controls.timeline.media",Rr),ow("view.scan",Xi),ow("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),ow("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),ow("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),ow("live.layout",Ai),cw("media_viewer.layout"),cw("image.layout"),lw(bs,hw),e=>dw(hw)("object"==typeof e&&e?e[Ii]:{}),e=>dw(hw)("object"==typeof e&&e?e.automations:{}),lw(Ca,ow("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),ow("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),lw(bs,rw("overrides","merge")),ow("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),sw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),ow("view.update_cycle_camera",Wi),ow("view.update_force",Qi,{transform:e=>!0===e?"all":null}),ow("view.update_seconds",Gi),ow("view.update_entities",Yi),rw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),cw("live.controls.title"),cw("media_viewer.controls.title"),e=>dw(pw)("object"==typeof e&&e?e:{}),ow("dimensions.max_height",ys),cw("dimensions.min_height")];class _w extends zs{}class vw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function yw(e,t,n){let a=tw(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{ew(a,e)})),Object.keys(t.set??{}).forEach((e=>{Xb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Xb(a,e,Ly({},Jb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new _w(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class bw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)<e.below);case"user":return!!n.user&&e.users.includes(n.user.id);case"media_loaded":return void 0!==n.media_loaded&&e.media_loaded===n.media_loaded;case"screen":return window.matchMedia(e.media_query).matches;case"display_mode":return!!n.displayMode&&e.display_mode===n.displayMode;case"triggered":return e.triggered.some((e=>n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const ww={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},xw=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in ww&&Object.entries(ww[e]).forEach((([e,n])=>{return r=n,void(void 0===Jb(i,a=e)&&Xb(t,a,r));var a,r}));return t},Cw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"}
/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Mw=(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=Cw(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 kw{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=iw(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=xw(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(Zb.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=Mw(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=yw(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(Zb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Zb.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 Sw{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()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Ew=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},$w=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Tb(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Ew(i)},Aw=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class zw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await $w(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Ew(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Iw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Tw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],jw=(()=>{if("undefined"==typeof document)return!1;const e=Tw[0],t={};for(const n of Tw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Ow={change:jw.fullscreenchange,error:jw.fullscreenerror};let Dw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Dw.off("change",i),n()};Dw.on("change",i);const r=e[jw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Dw.isFullscreen)return void e();const n=()=>{Dw.off("change",n),e()};Dw.on("change",n);const a=document[jw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Dw.isFullscreen?Dw.exit():Dw.request(e,t),onchange(e){Dw.on("change",e)},onerror(e){Dw.on("error",e)},on(e,t){const n=Ow[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Ow[e];n&&document.removeEventListener(n,t,!1)},raw:jw};Object.defineProperties(Dw,{isFullscreen:{get:()=>Boolean(document[jw.fullscreenElement])},element:{enumerable:!0,get:()=>document[jw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[jw.fullscreenEnabled])}}),jw||(Dw={isEnabled:!1});var Rw=Dw;class Pw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Rw.isEnabled&&Rw.on("change",this._fullscreenHandler)}disconnect(){Rw.isEnabled&&Rw.off("change",this._fullscreenHandler)}isInFullscreen(){return Rw.isEnabled&&Rw.isFullscreen}toggleFullscreen(){Rw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Rw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Lw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=jb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Nw{constructor(e){this._hass=null,this._stateWatcher=new Lw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Fw=function(){return th.Date.now()},Vw="Expected a function",Hw=Math.max,Bw=Math.min;function qw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Vw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Fw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Bw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Fw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Hw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Fw())},_}function Uw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),qw(e,t,{leading:a,maxWait:t,trailing:i})}class Ww{constructor(e){this._timer=new xf,this.reportInteraction=Uw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Zw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Qw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Gw(e,t,n){const a=Qw(t,n);a&&Yw(e,a)}function Yw(e,t){Bg(e,"media:loaded",t)}function Kw(e){Bg(e,"media:unloaded")}function Xw(e){Bg(e,"media:volumechange")}function Jw(e){Bg(e,"media:play")}function ex(e){Bg(e,"media:pause")}class tx{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class nx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class ax{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&yb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(yb(n,4096))a="media_stop";else{if(!yb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:nx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ix{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&n<t)&&(this._message=e,this._api.getMediaLoadedInfoManager().clear(),this._api.getCardElementManager().scrollReset(),this._api.getCardElementManager().update(),!0)}}class rx{constructor(e){this._timer=new xf,this._listeners=[],this._mute=!0,this._api=e}initialize(){this._setConditionState()}shouldConnectOnInitialization(){return!!this._api.getConfigManager().getConfig()?.live.microphone?.always_connected&&this.isSupported()}isSupported(){return!!navigator.mediaDevices?.getUserMedia}async connect(){if(!this.isSupported())return!1;try{this._stream=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1})}catch(e){return Gg(e),this._stream=null,this._api.getCardElementManager().update(),!1}return this._setMute(),this._setConditionState(),!0}disconnect(){this._stream?.getTracks().forEach((e=>e.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ox{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?<cardID>\w+))?[.:](?<action>\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class sx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class cx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class lx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Uw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start(
/* 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 dx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class ux{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=dx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class hx extends ux{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class px extends ux{}class mx{static areEventQueries(e){return e instanceof hx}static areRecordingQueries(e){return e instanceof px}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 gx=(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)}},fx=(e,t)=>Ly({},e,t);class _x{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 _x({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 _x({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=fx(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 vx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class yx extends zs{}class bx extends zs{}class wx{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=[...gx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=gx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new yx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new bx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new _x(o);return vx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!gx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class xx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class Cx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Mx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class kx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new kx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&e<this._results.length)&&(this._selectedIndex=e)}selectResultIfFound(e){for(const[t,n]of this._results.entries())if(e(n)){this.selectIndex(t);break}}selectBestResult(e){const t=e(this._results);null!==t&&this.selectIndex(t)}}class Sx{constructor(e){this._resultsTimestamp=null,this._cameras=new Map,this._resultsTimestamp=new Date,this._main=new kx(e),this._buildByCameraSlices(e?.selectApproach)}_buildByCameraSlices(e){const t=new Map;for(const e of this._main.getResults()){const n=e.getCameraID(),a=t.get(n)??[];a.push(e),t.set(n,a)}for(const[n,a]of t.entries())this._cameras.set(n,new kx({results:a,selectApproach:e}))}clone(){const e=new Sx;e._resultsTimestamp=this._resultsTimestamp,e._main=this._main.clone();for(const[t,n]of this._cameras.entries())e._cameras.set(t,n.clone());return e}isSupersetOf(e){const t=new Set(this._main.getResults()?.map((e=>e.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Ex{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new hx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new px(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Sx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Mx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class $x{constructor(e,t){this._api=e,this._executor=t??new Ex(e)}async getExistingQueryModifiers(e,t){return e.query?[new Cx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{
/* 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 Cx(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 xx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new xx("mediaViewer","seek")]}}class Ax{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 wx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new $x(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),vx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=mx.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!!gx(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 zx{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 kw(this),this._defaultManager=new Sw(this),this._downloadManager=new zw(this),this._expandManager=new Iw(this),this._fullscreenManager=new Pw(this),this._hassManager=new Nw(this),this._initializationManager=new Qb(this),this._interactionManager=new Ww(this),this._keyboardStateManager=new Zw(this),this._mediaLoadedInfoManager=new tx(this),this._mediaPlayerManager=new ax(this),this._messageManager=new ix(this),this._microphoneManager=new rx(this),this._queryStringManager=new ox(this),this._statusBarItemManager=new sx(this),this._styleManager=new cx(this),this._triggersManager=new lx(this),this._viewManager=new Ax(this),e.addController(this),this._conditionsManager=new bw(this,a),this._cardElementManager=new Gb(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-837da8b4.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.getCardElementManager().elementDisconnected()}}class Ix{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!vb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return vb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Nb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Fb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?gx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}}
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
function Tx(e){return null==e}var jx=function(e,t){var n,a="";for(n=0;n<t;n+=1)a+=e;return a},Ox={isNothing:Tx,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:Tx(e)?[]:[e]},repeat:jx,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 Dx(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 Rx(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Dx(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}Rx.prototype=Object.create(Error.prototype),Rx.prototype.constructor=Rx,Rx.prototype.toString=function(e){return this.name+": "+Dx(this,e)};var Px=Rx;function Lx(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 Nx(e,t){return Ox.repeat(" ",t-e.length)+e}var Fx=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=Lx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Ox.repeat(" ",t.indent)+Nx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Lx(e.buffer,i[o],r[o],e.position,u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Ox.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Lx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Vx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Hx=["scalar","sequence","mapping"];var Bx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Vx.indexOf(t))throw new Px('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===Hx.indexOf(this.kind))throw new Px('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function qx(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 Ux(e){return this.extend(e)}Ux.prototype.extend=function(e){var t=[],n=[];if(e instanceof Bx)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 Px("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 Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Px("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Px("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Ux.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=qx(a,"implicit"),a.compiledExplicit=qx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(a);return n}(a.compiledImplicit,a.compiledExplicit),a};var Wx=Ux,Zx=new Bx("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),Qx=new Bx("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),Gx=new Bx("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),Yx=new Wx({explicit:[Zx,Qx,Gx]});var Kx=new Bx("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var Xx=new Bx("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Jx(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function eC(e){return 48<=e&&e<=55}function tC(e){return 48<=e&&e<=57}var nC=new Bx("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,a=0,i=!1;if(!n)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===n)return!0;if("b"===(t=e[++a])){for(a++;a<n;a++)if("_"!==(t=e[a])){if("0"!==t&&"1"!==t)return!1;i=!0}return i&&"_"!==t}if("x"===t){for(a++;a<n;a++)if("_"!==(t=e[a])){if(!Jx(e.charCodeAt(a)))return!1;i=!0}return i&&"_"!==t}if("o"===t){for(a++;a<n;a++)if("_"!==(t=e[a])){if(!eC(e.charCodeAt(a)))return!1;i=!0}return i&&"_"!==t}}if("_"===t)return!1;for(;a<n;a++)if("_"!==(t=e[a])){if(!tC(e.charCodeAt(a)))return!1;i=!0}return!(!i||"_"===t)},construct:function(e){var t,n=e,a=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(a=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return a*parseInt(n.slice(2),2);if("x"===n[1])return a*parseInt(n.slice(2),16);if("o"===n[1])return a*parseInt(n.slice(2),8)}return a*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!Ox.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),aC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var iC=/^[-+]?[0-9]+e/;var rC=new Bx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!aC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Ox.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ox.isNegativeZero(e))return"-0.0";return n=e.toString(10),iC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),oC=Yx.extend({implicit:[Kx,Xx,nC,rC]}),sC=oC,cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),lC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var dC=new Bx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==cC.exec(e)||null!==lC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=cC.exec(e))&&(t=lC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var uC=new Bx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),hC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var pC=new Bx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=hC;for(n=0;n<i;n++)if(!((t=r.indexOf(e.charAt(n)))>64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=hC,o=0,s=[];for(t=0;t<i;t++)t%4==0&&t&&(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=hC;for(t=0;t<r;t++)t%3==0&&t&&(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),mC=Object.prototype.hasOwnProperty,gC=Object.prototype.toString;var fC=new Bx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t<n;t+=1){if(a=s[t],r=!1,"[object Object]"!==gC.call(a))return!1;for(i in a)if(mC.call(a,i)){if(r)return!1;r=!0}if(!r)return!1;if(-1!==o.indexOf(i))return!1;o.push(i)}return!0},construct:function(e){return null!==e?e:[]}}),_C=Object.prototype.toString;var vC=new Bx("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=e;for(r=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(a=o[t],"[object Object]"!==_C.call(a))return!1;if(1!==(i=Object.keys(a)).length)return!1;r[t]=[i[0],a[i[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,a,i,r,o=e;for(r=new Array(o.length),t=0,n=o.length;t<n;t+=1)a=o[t],i=Object.keys(a),r[t]=[i[0],a[i[0]]];return r}}),yC=Object.prototype.hasOwnProperty;var bC=new Bx("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(yC.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),wC=sC.extend({implicit:[dC,uC],explicit:[pC,fC,vC,bC]}),xC=Object.prototype.hasOwnProperty,CC=1,MC=2,kC=3,SC=4,EC=1,$C=2,AC=3,zC=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,IC=/[\x85\u2028\u2029]/,TC=/[,\[\]\{\}]/,jC=/^(?:!|!!|![a-z\-]+!)$/i,OC=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function DC(e){return Object.prototype.toString.call(e)}function RC(e){return 10===e||13===e}function PC(e){return 9===e||32===e}function LC(e){return 9===e||32===e||10===e||13===e}function NC(e){return 44===e||91===e||93===e||123===e||125===e}function FC(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function VC(e){return 120===e?2:117===e?4:85===e?8:0}function HC(e){return 48<=e&&e<=57?e-48:-1}function BC(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function qC(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var UC=new Array(256),WC=new Array(256),ZC=0;ZC<256;ZC++)UC[ZC]=BC(ZC)?1:0,WC[ZC]=BC(ZC);function QC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||wC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function GC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Fx(n),new Px(t,n)}function YC(e,t){throw GC(e,t)}function KC(e,t){e.onWarning&&e.onWarning.call(null,GC(e,t))}var XC={YAML:function(e,t,n){var a,i,r;null!==e.version&&YC(e,"duplication of %YAML directive"),1!==n.length&&YC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&YC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&YC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&KC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&YC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],jC.test(a)||YC(e,"ill-formed tag handle (first argument) of the TAG directive"),xC.call(e.tagMap,a)&&YC(e,'there is a previously declared suffix for "'+a+'" tag handle'),OC.test(i)||YC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){YC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function JC(e,t,n,a){var i,r,o,s;if(t<n){if(s=e.input.slice(t,n),a)for(i=0,r=s.length;i<r;i+=1)9===(o=s.charCodeAt(i))||32<=o&&o<=1114111||YC(e,"expected valid JSON character");else zC.test(s)&&YC(e,"the stream contains non-printable characters");e.result+=s}}function eM(e,t,n,a){var i,r,o,s;for(Ox.isObject(n)||YC(e,"cannot merge mappings; the provided source object is unacceptable"),o=0,s=(i=Object.keys(n)).length;o<s;o+=1)r=i[o],xC.call(t,r)||(t[r]=n[r],a[r]=!0)}function tM(e,t,n,a,i,r,o,s,c){var l,d;if(Array.isArray(i))for(l=0,d=(i=Array.prototype.slice.call(i)).length;l<d;l+=1)Array.isArray(i[l])&&YC(e,"nested arrays are not supported inside keys"),"object"==typeof i&&"[object Object]"===DC(i[l])&&(i[l]="[object Object]");if("object"==typeof i&&"[object Object]"===DC(i)&&(i="[object Object]"),i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===a)if(Array.isArray(r))for(l=0,d=r.length;l<d;l+=1)eM(e,t,r[l],n);else eM(e,t,r,n);else e.json||xC.call(n,i)||!xC.call(t,i)||(e.line=o||e.line,e.lineStart=s||e.lineStart,e.position=c||e.position,YC(e,"duplicated mapping key")),"__proto__"===i?Object.defineProperty(t,i,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[i]=r,delete n[i];return t}function nM(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):YC(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function aM(e,t,n){for(var a=0,i=e.input.charCodeAt(e.position);0!==i;){for(;PC(i);)9===i&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&35===i)do{i=e.input.charCodeAt(++e.position)}while(10!==i&&13!==i&&0!==i);if(!RC(i))break;for(nM(e),i=e.input.charCodeAt(e.position),a++,e.lineIndent=0;32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return-1!==n&&0!==a&&e.lineIndent<n&&KC(e,"deficient indentation"),a}function iM(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!LC(t)))}function rM(e,t){1===t?e.result+=" ":t>1&&(e.result+=Ox.repeat("\n",t-1))}function oM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,YC(e,"tab characters must not be used in indentation")),45===a)&&LC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,aM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,lM(e,t,kC,!1,!0),o.push(e.result),aM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)YC(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=i,e.anchor=r,e.kind="sequence",e.result=o,!0)}function sM(e){var t,n,a,i,r=!1,o=!1;if(33!==(i=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&YC(e,"duplication of a tag property"),60===(i=e.input.charCodeAt(++e.position))?(r=!0,i=e.input.charCodeAt(++e.position)):33===i?(o=!0,n="!!",i=e.input.charCodeAt(++e.position)):n="!",t=e.position,r){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&62!==i);e.position<e.length?(a=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):YC(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!LC(i);)33===i&&(o?YC(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),jC.test(n)||YC(e,"named tag handle cannot contain such characters"),o=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),TC.test(a)&&YC(e,"tag suffix cannot contain flow indicator characters")}a&&!OC.test(a)&&YC(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch(t){YC(e,"tag name is malformed: "+a)}return r?e.tag=a:xC.call(e.tagMap,n)?e.tag=e.tagMap[n]+a:"!"===n?e.tag="!"+a:"!!"===n?e.tag="tag:yaml.org,2002:"+a:YC(e,'undeclared tag handle "'+n+'"'),!0}function cM(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&YC(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!LC(n)&&!NC(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&YC(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function lM(e,t,n,a,i){var r,o,s,c,l,d,u,h,p,m=1,g=!1,f=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,r=o=s=SC===n||kC===n,a&&aM(e,!0,-1)&&(g=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;sM(e)||cM(e);)aM(e,!0,-1)?(g=!0,s=r,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):s=!1;if(s&&(s=g||i),1!==m&&SC!==n||(h=CC===n||MC===n?t:t+1,p=e.position-e.lineStart,1===m?s&&(oM(e,p)||function(e,t,n){var a,i,r,o,s,c,l,d=e.tag,u=e.anchor,h={},p=Object.create(null),m=null,g=null,f=null,_=!1,v=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=h),l=e.input.charCodeAt(e.position);0!==l;){if(_||-1===e.firstTabInLine||(e.position=e.firstTabInLine,YC(e,"tab characters must not be used in indentation")),a=e.input.charCodeAt(e.position+1),r=e.line,63!==l&&58!==l||!LC(a)){if(o=e.line,s=e.lineStart,c=e.position,!lM(e,n,MC,!1,!0))break;if(e.line===r){for(l=e.input.charCodeAt(e.position);PC(l);)l=e.input.charCodeAt(++e.position);if(58===l)LC(l=e.input.charCodeAt(++e.position))||YC(e,"a whitespace character is expected after the key-value separator within a block mapping"),_&&(tM(e,h,p,m,g,null,o,s,c),m=g=f=null),v=!0,_=!1,i=!1,m=e.tag,g=e.result;else{if(!v)return e.tag=d,e.anchor=u,!0;YC(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!v)return e.tag=d,e.anchor=u,!0;YC(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(_&&(tM(e,h,p,m,g,null,o,s,c),m=g=f=null),v=!0,_=!0,i=!0):_?(_=!1,i=!0):YC(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,l=a;if((e.line===r||e.lineIndent>t)&&(_&&(o=e.line,s=e.lineStart,c=e.position),lM(e,t,SC,!0,i)&&(_?g=e.result:f=e.result),_||(tM(e,h,p,m,g,f,o,s,c),m=g=f=null),aM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)YC(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return _&&tM(e,h,p,m,g,null,o,s,c),v&&(e.tag=d,e.anchor=u,e.kind="mapping",e.result=h),v}(e,p,h))||function(e,t){var n,a,i,r,o,s,c,l,d,u,h,p,m=!0,g=e.tag,f=e.anchor,_=Object.create(null);if(91===(p=e.input.charCodeAt(e.position)))o=93,l=!1,r=[];else{if(123!==p)return!1;o=125,l=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),p=e.input.charCodeAt(++e.position);0!==p;){if(aM(e,!0,t),(p=e.input.charCodeAt(e.position))===o)return e.position++,e.tag=g,e.anchor=f,e.kind=l?"mapping":"sequence",e.result=r,!0;m?44===p&&YC(e,"expected the node content, but found ','"):YC(e,"missed comma between flow collection entries"),h=null,s=c=!1,63===p&&LC(e.input.charCodeAt(e.position+1))&&(s=c=!0,e.position++,aM(e,!0,t)),n=e.line,a=e.lineStart,i=e.position,lM(e,t,CC,!1,!0),u=e.tag,d=e.result,aM(e,!0,t),p=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==p||(s=!0,p=e.input.charCodeAt(++e.position),aM(e,!0,t),lM(e,t,CC,!1,!0),h=e.result),l?tM(e,r,_,u,d,h,n,a,i):s?r.push(tM(e,null,_,u,d,h,n,a,i)):r.push(d),aM(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(m=!0,p=e.input.charCodeAt(++e.position)):m=!1}YC(e,"unexpected end of the stream within a flow collection")}(e,h)?f=!0:(o&&function(e,t){var n,a,i,r,o=EC,s=!1,c=!1,l=t,d=0,u=!1;if(124===(r=e.input.charCodeAt(e.position)))a=!1;else{if(62!==r)return!1;a=!0}for(e.kind="scalar",e.result="";0!==r;)if(43===(r=e.input.charCodeAt(++e.position))||45===r)EC===o?o=43===r?AC:$C:YC(e,"repeat of a chomping mode identifier");else{if(!((i=HC(r))>=0))break;0===i?YC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?YC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(PC(r)){do{r=e.input.charCodeAt(++e.position)}while(PC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!RC(r)&&0!==r)}for(;0!==r;){for(nM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndent<l)&&32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>l&&(l=e.lineIndent),RC(r))d++;else{if(e.lineIndent<l){o===AC?e.result+=Ox.repeat("\n",s?1+d:d):o===EC&&s&&(e.result+="\n");break}for(a?PC(r)?(u=!0,e.result+=Ox.repeat("\n",s?1+d:d)):u?(u=!1,e.result+=Ox.repeat("\n",d+1)):0===d?s&&(e.result+=" "):e.result+=Ox.repeat("\n",d):e.result+=Ox.repeat("\n",s?1+d:d),s=!0,c=!0,d=0,n=e.position;!RC(r)&&0!==r;)r=e.input.charCodeAt(++e.position);JC(e,n,e.position,!1)}}return!0}(e,h)||function(e,t){var n,a,i;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,a=i=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(JC(e,a,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;a=e.position,e.position++,i=e.position}else RC(n)?(JC(e,a,i,!0),rM(e,aM(e,!1,t)),a=i=e.position):e.position===e.lineStart&&iM(e)?YC(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);YC(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var n,a,i,r,o,s;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=a=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return JC(e,n,e.position,!0),e.position++,!0;if(92===s){if(JC(e,n,e.position,!0),RC(s=e.input.charCodeAt(++e.position)))aM(e,!1,t);else if(s<256&&UC[s])e.result+=WC[s],e.position++;else if((o=VC(s))>0){for(i=o,r=0;i>0;i--)(o=FC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:YC(e,"expected hexadecimal character");e.result+=qC(r),e.position++}else YC(e,"unknown escape sequence");n=a=e.position}else RC(s)?(JC(e,n,a,!0),rM(e,aM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&iM(e)?YC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}YC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!LC(a)&&!NC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&YC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),xC.call(e.anchorMap,n)||YC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],aM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(LC(d=e.input.charCodeAt(e.position))||NC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a))break}else if(35===d){if(LC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&iM(e)||n&&NC(d))break;if(RC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,aM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(JC(e,i,r,!1),rM(e,e.line-s),i=r=e.position,o=!1),PC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return JC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,CC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||YC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&oM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&YC(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c<l;c+=1)if((u=e.implicitTypes[c]).resolve(e.result)){e.result=u.construct(e.result),e.tag=u.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(xC.call(e.typeMap[e.kind||"fallback"],e.tag))u=e.typeMap[e.kind||"fallback"][e.tag];else for(u=null,c=0,l=(d=e.typeMap.multi[e.kind||"fallback"]).length;c<l;c+=1)if(e.tag.slice(0,d[c].tag.length)===d[c].tag){u=d[c];break}u||YC(e,"unknown tag !<"+e.tag+">"),null!==e.result&&u.kind!==e.kind&&YC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):YC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function dM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(aM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&YC(e,"directive name must not be less than one character in length");0!==i;){for(;PC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!RC(i));break}if(RC(i))break;for(t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&nM(e),xC.call(XC,n)?XC[n](e,n,a):KC(e,'unknown document directive "'+n+'"')}aM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,aM(e,!0,-1)):o&&YC(e,"directives end mark is expected"),lM(e,e.lineIndent-1,SC,!1,!0),aM(e,!0,-1),e.checkLineBreaks&&IC.test(e.input.slice(r,e.position))&&KC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&iM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,aM(e,!0,-1)):e.position<e.length-1&&YC(e,"end of the stream or a document separator is expected")}function uM(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new QC(e,t),a=e.indexOf("\0");for(-1!==a&&(n.position=a,YC(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)dM(n);return n.documents}var hM={loadAll:function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var a=uM(e,n);if("function"!=typeof t)return a;for(var i=0,r=a.length;i<r;i+=1)t(a[i])},load:function(e,t){var n=uM(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new Px("expected a single document in the stream, but found more")}}},pM=Object.prototype.toString,mM=Object.prototype.hasOwnProperty,gM=65279,fM=9,_M=10,vM=13,yM=32,bM=33,wM=34,xM=35,CM=37,MM=38,kM=39,SM=42,EM=44,$M=45,AM=58,zM=61,IM=62,TM=63,jM=64,OM=91,DM=93,RM=96,PM=123,LM=124,NM=125,FM={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},VM=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],HM=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function BM(e){var t,n,a;if(t=e.toString(16).toUpperCase(),e<=255)n="x",a=2;else if(e<=65535)n="u",a=4;else{if(!(e<=4294967295))throw new Px("code point within a string may not be greater than 0xFFFFFFFF");n="U",a=8}return"\\"+n+Ox.repeat("0",a-t.length)+t}var qM=1,UM=2;function WM(e){this.schema=e.schema||wC,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Ox.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,a,i,r,o,s,c;if(null===t)return{};for(n={},i=0,r=(a=Object.keys(t)).length;i<r;i+=1)o=a[i],s=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(c=e.compiledTypeMap.fallback[o])&&mM.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[o]=s;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?UM:qM,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ZM(e,t){for(var n,a=Ox.repeat(" ",t),i=0,r=-1,o="",s=e.length;i<s;)-1===(r=e.indexOf("\n",i))?(n=e.slice(i),i=s):(n=e.slice(i,r+1),i=r+1),n.length&&"\n"!==n&&(o+=a),o+=n;return o}function QM(e,t){return"\n"+Ox.repeat(" ",e.indent*t)}function GM(e){return e===yM||e===fM}function YM(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==gM||65536<=e&&e<=1114111}function KM(e){return YM(e)&&e!==gM&&e!==vM&&e!==_M}function XM(e,t,n){var a=KM(e),i=a&&!GM(e);return(n?a:a&&e!==EM&&e!==OM&&e!==DM&&e!==PM&&e!==NM)&&e!==xM&&!(t===AM&&!i)||KM(t)&&!GM(t)&&e===xM||t===AM&&i}function JM(e,t){var n,a=e.charCodeAt(t);return a>=55296&&a<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1))>=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function ek(e){return/^\n* /.test(e)}var tk=1,nk=2,ak=3,ik=4,rk=5;function ok(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return YM(e)&&e!==gM&&!GM(e)&&e!==$M&&e!==TM&&e!==AM&&e!==EM&&e!==OM&&e!==DM&&e!==PM&&e!==NM&&e!==xM&&e!==MM&&e!==SM&&e!==bM&&e!==LM&&e!==zM&&e!==IM&&e!==kM&&e!==wM&&e!==CM&&e!==jM&&e!==RM}(JM(e,0))&&function(e){return!GM(e)&&e!==AM}(JM(e,e.length-1));if(t||o)for(c=0;c<e.length;l>=65536?c+=2:c++){if(!YM(l=JM(e,c)))return rk;g=g&&XM(l,d,s),d=l}else{for(c=0;c<e.length;l>=65536?c+=2:c++){if((l=JM(e,c))===_M)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!YM(l))return rk;g=g&&XM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&ek(e)?rk:o?r===UM?rk:nk:h?ik:ak:!g||o||i(e)?r===UM?rk:nk:tk}function sk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===UM?'""':"''";if(!e.noCompatMode&&(-1!==VM.indexOf(t)||HM.test(t)))return e.quotingType===UM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ok(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n<a;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(e,t)}),e.quotingType,e.forceQuotes&&!a,i)){case tk:return t;case nk:return"'"+t.replace(/'/g,"''")+"'";case ak:return"|"+ck(t,e.indent)+lk(ZM(t,r));case ik:return">"+ck(t,e.indent)+lk(ZM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,dk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+dk(l,t),o=n}return r}(t,o),r));case rk:return'"'+function(e){for(var t,n="",a=0,i=0;i<e.length;a>=65536?i+=2:i++)a=JM(e,i),!(t=FM[a])&&YM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||BM(a);return n}(t)+'"';default:throw new Px("impossible error: invalid scalar style")}}()}function ck(e,t){var n=ek(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function lk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function dk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function uk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i<r;i+=1)o=n[i],e.replacer&&(o=e.replacer.call(n,String(i),o)),(pk(e,t+1,o,!0,!0,!1,!0)||void 0===o&&pk(e,t+1,null,!0,!0,!1,!0))&&(a&&""===s||(s+=QM(e,t)),e.dump&&_M===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=c,e.dump=s||"[]"}function hk(e,t,n){var a,i,r,o,s,c;for(r=0,o=(i=n?e.explicitTypes:e.implicitTypes).length;r<o;r+=1)if(((s=i[r]).instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(n?s.multi&&s.representName?e.tag=s.representName(t):e.tag=s.tag:e.tag="?",s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===pM.call(s.represent))a=s.represent(t,c);else{if(!mM.call(s.represent,c))throw new Px("!<"+s.tag+'> tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function pk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,hk(e,n,!1)||hk(e,n,!0);var s,c=pM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Px("sortKeys must be a boolean or a function");for(i=0,r=h.length;i<r;i+=1)l="",a&&""===d||(l+=QM(e,t)),s=n[o=h[i]],e.replacer&&(s=e.replacer.call(n,o,s)),pk(e,t+1,o,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=QM(e,t)),pk(e,t+1,s,!0,c)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a<i;a+=1)s="",""!==c&&(s+=", "),e.condenseFlow&&(s+='"'),o=n[r=d[a]],e.replacer&&(o=e.replacer.call(n,r,o)),pk(e,t,r,!1,!1)&&(e.dump.length>1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),pk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?uk(e,t-1,e.dump,i):uk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a<i;a+=1)r=n[a],e.replacer&&(r=e.replacer.call(n,String(a),r)),(pk(e,t,r,!1,!1)||void 0===r&&pk(e,t,null,!1,!1))&&(""!==o&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=s,e.dump="["+o+"]"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else{if("[object String]"!==c){if("[object Undefined]"===c)return!1;if(e.skipInvalid)return!1;throw new Px("unacceptable kind of an object to dump "+c)}"?"!==e.tag&&sk(e,e.dump,t,r,l)}null!==e.tag&&"?"!==e.tag&&(s=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),s="!"===e.tag[0]?"!"+s:"tag:yaml.org,2002:"===s.slice(0,18)?"!!"+s.slice(18):"!<"+s+">",e.dump=s+" "+e.dump)}return!0}function mk(e,t){var n,a,i=[],r=[];for(gk(e,i,r),n=0,a=r.length;n<a;n+=1)t.duplicates.push(i[r[n]]);t.usedDuplicates=new Array(a)}function gk(e,t,n){var a,i,r;if(null!==e&&"object"==typeof e)if(-1!==(i=t.indexOf(e)))-1===n.indexOf(i)&&n.push(i);else if(t.push(e),Array.isArray(e))for(i=0,r=e.length;i<r;i+=1)gk(e[i],t,n);else for(i=0,r=(a=Object.keys(e)).length;i<r;i+=1)gk(e[a[i]],t,n)}function fk(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var _k={Type:Bx,Schema:Wx,FAILSAFE_SCHEMA:Yx,JSON_SCHEMA:oC,CORE_SCHEMA:sC,DEFAULT_SCHEMA:wC,load:hM.load,loadAll:hM.loadAll,dump:{dump:function(e,t){var n=new WM(t=t||{});n.noRefs||mk(e,n);var a=e;return n.replacer&&(a=n.replacer.call({"":a},"",a)),pk(n,0,a,!0,!0)?n.dump+"\n":""}}.dump,YAMLException:Px,types:{binary:pC,float:rC,map:Gx,null:Kx,pairs:vC,set:bC,timestamp:dC,bool:Xx,int:nC,merge:uC,omap:fC,seq:Qx,str:Zx},safeLoad:fk("safeLoad","load"),safeLoadAll:fk("safeLoadAll","loadAll"),safeDump:fk("safeDump","dump")},vk='.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n user-select: text;\n -webkit-user-select: text;\n color: var(--primary-text-color);\n}\n\ndiv.wrapper {\n height: 100%;\n}\n\ndiv.message {\n display: flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n height: 100%;\n}\n\ndiv.message.padded {\n padding: 20px;\n}\n\ndiv.message div.contents {\n display: flex;\n flex-direction: column;\n padding: 10px;\n margin-top: auto;\n margin-bottom: auto;\n min-width: 0;\n}\n\ndiv.message div.icon {\n padding: 10px;\n}\n\n.vertical {\n flex-direction: column;\n}\n\n.message a {\n color: var(--primary-text-color, white);\n word-break: break-word;\n}\n\n.message pre {\n margin-top: 20px;\n overflow-x: auto;\n border: 1px dotted var(--divider-color);\n padding: 1em;\n}';let yk=class extends se{constructor(){super(...arguments),this.message=""}render(){const e=this.icon?this.icon:"mdi:information-outline",t={dotdotdot:!!this.dotdotdot},n=e=>q`<pre>${_k.dump(e)}</pre>`;return q` <div class="wrapper">
<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(vk)}};e([he({attribute:!1})],yk.prototype,"message",void 0),e([he({attribute:!1})],yk.prototype,"context",void 0),e([he({attribute:!1})],yk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],yk.prototype,"dotdotdot",void 0),yk=e([le("frigate-card-message")],yk);let bk=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(vk)}};e([he({attribute:!1})],bk.prototype,"message",void 0),bk=e([le("frigate-card-error-message")],bk);let wk=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(vk)}};function xk(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 Ck(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 Mk(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function kk(e,t,n){Mk(e,t,"error",{context:n?.context})}function Sk(e,t){t instanceof Error&&kk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],wk.prototype,"message",void 0),e([he({attribute:!1})],wk.prototype,"animated",void 0),e([he({attribute:!1})],wk.prototype,"size",void 0),wk=e([le("frigate-card-progress-indicator")],wk);let Ek=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 Sk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Ek.prototype,"elements",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"hass",void 0),Ek=e([le("frigate-card-elements-core")],Ek);let $k=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})],$k.prototype,"hass",void 0),e([he({attribute:!1})],$k.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],$k.prototype,"elements",void 0),$k=e([le("frigate-card-elements")],$k);let Ak=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 vw(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})],Ak.prototype,"hass",void 0),Ak=e([le("frigate-card-conditional")],Ak);class zk 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()],zk.prototype,"_config",void 0);class Ik extends zk{constructor(){super("menu")}}let Tk=class extends Ik{};Tk=e([le("frigate-card-menu-icon")],Tk);let jk=class extends Ik{};jk=e([le("frigate-card-menu-state-icon")],jk);let Ok=class extends Ik{};Ok=e([le("frigate-card-menu-submenu")],Ok);let Dk=class extends Ik{};Dk=e([le("frigate-card-menu-submenu-select")],Dk);class Rk extends zk{constructor(){super("status-bar")}}let Pk=class extends Rk{};Pk=e([le("frigate-card-status-bar-icon")],Pk);let Lk=class extends Rk{};Lk=e([le("frigate-card-status-bar-image")],Lk);let Nk=class extends Rk{};Nk=e([le("frigate-card-status-bar-string")],Nk);let Fk=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}")}};Fk=e([le("frigate-card-loading")],Fk);const Vk=(e,t)=>{Bg(e,"action:execution-request",t)};class Hk{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(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Vk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Lb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' 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='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Uk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' 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='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Wk=e=>{switch(e){case"frigate":return Bk;case"motioneye":return qk;case"reolink":return Uk;default:return null}};const Zk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Qk=class extends se{_renderItem(e){if(!this.hass)return;const t=Lb(this.hass,{...e});return q`
<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=Wk(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[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[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-button[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-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenu",void 0),Qk=e([le("frigate-card-submenu")],Qk);let Gk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Ob(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Zk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ib("select"),...Lb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` <frigate-card-submenu
.hass=${this.hass}
.submenu=${this._generatedSubmenu}
></frigate-card-submenu>`}};e([he({attribute:!1})],Gk.prototype,"hass",void 0),e([he({attribute:!1})],Gk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([pe()],Gk.prototype,"_optionTitles",void 0),Gk=e([le("frigate-card-submenu-select")],Gk);let Yk=class extends se{constructor(){super(...arguments),this._controller=new Hk(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=Wk(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-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[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-button[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-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Yk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Yk.prototype,"hass",void 0),Yk=e([le("frigate-card-menu")],Yk);let Kk=class extends se{render(){return q`
<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[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[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-button[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-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Kk=e([le("frigate-card-overlay")],Kk);class Xk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Vk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){
/* 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 Jk=class extends se{constructor(){super(...arguments),this._controller=new Xk(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=Wk(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[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[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-button[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-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Jk.prototype,"items",void 0),e([he({attribute:!1})],Jk.prototype,"config",void 0),Jk=e([le("frigate-card-status-bar")],Jk);function eS(e){return"number"==typeof e}function tS(e){return"string"==typeof e}function nS(e){return"boolean"==typeof e}function aS(e){return"[object Object]"===Object.prototype.toString.call(e)}function iS(e){return Math.abs(e)}function rS(e){return Math.sign(e)}function oS(e,t){return iS(e-t)}function sS(e){return hS(e).map(Number)}function cS(e){return e[lS(e)]}function lS(e){return Math.max(0,e.length-1)}function dS(e,t){return t===lS(e)}function uS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function hS(e){return Object.keys(e)}function pS(e,t){return[e,t].reduce(((e,t)=>(hS(t).forEach((n=>{const a=e[n],i=t[n],r=aS(a)&&aS(i);e[n]=r?pS(a,i):i})),e)),{})}function mS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function gS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function fS(e,t,n,a){const i=gS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function _S(e=0,t=0){const n=iS(e-t);function a(t){return t<e}function i(e){return e>t}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function vS(e,t,n){const{constrain:a}=_S(0,e),i=e+1;let r=o(t);function o(e){return n?iS((i+e)%i):a(e)}function s(){return r}function c(){return vS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function yS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=gS(),M=gS(),k=_S(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!mS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=oS(t,z),c=oS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*rS(e)),a=d.byDistance(e,!m).distance;return m||iS(e)<k?a:f&&t?.5*a:d.byIndex(n.get(),0).distance}(b(n),t),i=function(e,t){if(0===e||0===t)return 0;if(iS(e)<=iS(t))return 0;const n=oS(iS(e),iS(t));return iS(n/e)}(n,a),o=$-10*i,s=_+i/50;j=!1,T=!1,M.clear(),l.useDuration(o).useFriction(s),c.distance(a,!m),D=!1,h.emit("pointerUp")}function L(e){O&&(e.stopPropagation(),e.preventDefault(),O=!1)}return{init:function(e){if(!v)return;function s(s){(nS(v)||v(e,s))&&function(e){const s=mS(e,a);if(D=s,O=m&&s&&!e.buttons&&A,A=oS(i.get(),o.get())>=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function bS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(mS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&iS(c)>.1?c:0},readPoint:r}}function wS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(nS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(iS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function xS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=_S(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=iS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&iS(u)<r&&(n.set(e.constrain(n.get())),a.useDuration(25).useBaseFriction())},toggleActive:function(e){c=!e}}}function CS(e,t,n,a){const i=t.min+.1,r=t.max+.1,{reachedMin:o,reachedMax:s}=_S(i,r);const c={loop:function(t){if(!function(e){return 1===e?s(n.get()):-1===e&&o(n.get())}(t))return;const i=e*(-1*t);a.forEach((e=>e.add(i)))}};return c}function MS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>iS(e)-iS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>rS(e)===a));return r.length?c(r):cS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>iS(e.diff)-iS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function kS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(nS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));eS(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function SS(e){let t=e;function n(e){return eS(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function ES(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function $S(e,t,n,a,i,r,o,s,c){const l=.5,d=sS(i),u=sS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:SS(-1),translate:ES(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function AS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(nS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function zS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return hS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function IS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=eS(n);const p={groupSlides:function(e){return h?function(e,t){return sS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?sS(e).reduce(((n,h,p)=>{const m=cS(n)||0,g=0===m,f=h===lS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=iS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function TS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return tS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return iS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(cS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(iS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=IS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>cS(e)[o]-e[0][r])).map(iS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-iS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-cS(P)+cS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=_S(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=dS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=cS(o);return _S(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return oS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:_S(n?a-e:cS(t),a)}}(N,H,u),q=vS(lS(H),d,u),U=q.clone(),W=sS(n),Z=fS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=SS(Q),Y=SS(Q),K=SS(Q),X=SS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=rS(p),u=d,m},settled:function(){return iS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=MS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=gS(),ie=zS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?uS(cS(n[0])+1):i?uS(lS(r)-cS(n)[0]+1,cS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=kS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:yS(S,e,a,i,X,bS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:wS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:xS(B,K,X,J,$),scrollLooper:CS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:$S(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:AS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:ES(S,t)};return se}const jS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function OS(e){function t(e,t){return pS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=hS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>hS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function DS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=OS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=gS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(jS,DS.globalOptions),x=l(w),C=[];function M(t){const n=TS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=tS(t)?e.querySelector(t):t;v=a||e.children[0];const i=tS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function RS(){return RS=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},RS.apply(this,arguments)}DS.globalOptions=void 0;var PS=function(e,t){return void 0===t&&(t=.996),e*t/(1-t)};function LS(e,t){if(e.length!==t.length)throw new Error("vectors must be same length");return e.map((function(e,n){return e+t[n]}))}function NS(e){return Math.max.apply(Math,e.map(Math.abs))}function FS(e){return Object.freeze(e),Object.values(e).forEach((function(e){null===e||"object"!=typeof e||Object.isFrozen(e)||FS(e)})),e}var VS=[1,18,"undefined"!=typeof window&&window.innerHeight||800];var HS=[-1,-1,-1];var BS=function(e){return RS({},e,{axisDelta:e.axisDelta.map((function(e){return t=e,n=-700,a=700,Math.min(Math.max(n,t),a);var t,n,a}))})},qS=.6,US=.96,WS=2,ZS=5,QS=FS({preventWheelAction:!0,reverseSign:[!0,!0,!1]}),GS=400;function YS(){return{isStarted:!1,isStartPublished:!1,isMomentum:!1,startTime:0,lastAbsDelta:1/0,axisMovement:[0,0,0],axisVelocity:[0,0,0],accelerationFactors:[],scrollPoints:[],scrollPointsToMerge:[],willEndTimeout:GS}}function KS(e){void 0===e&&(e={});var t,n,a,i=function(){var e={};function t(t,n){e[t]=(e[t]||[]).filter((function(e){return e!==n}))}return FS({on:function(n,a){return e[n]=(e[n]||[]).concat(a),function(){return t(n,a)}},off:t,dispatch:function(t,n){t in e&&e[t].forEach((function(e){return e(n)}))}})}(),r=i.on,o=i.off,s=i.dispatch,c=QS,l=YS(),d=!1,u=function(e){Array.isArray(e)?e.forEach((function(e){return m(e)})):m(e)},h=function(e){return void 0===e&&(e={}),Object.values(e).some((function(e){return null==e}))?c:c=FS(RS({},QS,c,e))},p=function(e){var a=RS({event:t,isStart:!1,isEnding:!1,isMomentumCancel:!1,isMomentum:l.isMomentum,axisDelta:[0,0,0],axisVelocity:l.axisVelocity,axisMovement:l.axisMovement,get axisMovementProjection(){return LS(a.axisMovement,a.axisVelocity.map((function(e){return PS(e)})))}},e);s("wheel",RS({},a,{previous:n})),n=a},m=function(e){var n=BS(function(e,t){if(!t)return e;var n=!0===t?HS:t.map((function(e){return e?-1:1}));return RS({},e,{axisDelta:e.axisDelta.map((function(e,t){return e*n[t]}))})}(function(e){var t=e.deltaX*VS[e.deltaMode],n=e.deltaY*VS[e.deltaMode],a=(e.deltaZ||0)*VS[e.deltaMode];return{timeStamp:e.timeStamp,axisDelta:[t,n,a]}}(e),c.reverseSign)),a=n.axisDelta,i=n.timeStamp,r=NS(a);e.preventDefault&&function(e,t){var n=c.preventWheelAction,a=t[0],i=t[1],r=t[2];if("boolean"==typeof n)return n;switch(n){case"x":return Math.abs(a)>=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=LS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===WS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(LS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=US&&e>=qS},b=function(){if(l.accelerationFactors.length>=ZS){if(d&&(d=!1,NS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*ZS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=YS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return FS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),FS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var XS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function JS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(XS,JS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=KS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}JS.globalOptions=void 0;class eE{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=DS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[JS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let tE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q` <div class="embla">
<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 eE(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})],tE.prototype,"direction",void 0),e([he({attribute:!0})],tE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],tE.prototype,"loop",void 0),e([he({attribute:!1})],tE.prototype,"dragFree",void 0),e([he({attribute:!1})],tE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],tE.prototype,"plugins",void 0),e([he({attribute:!1})],tE.prototype,"selected",void 0),tE=e([le("frigate-card-carousel")],tE);
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const nE=window,aE=nE.ShadowRoot&&(void 0===nE.ShadyCSS||nE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,iE=Symbol(),rE=new WeakMap;let oE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==iE)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(aE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=rE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&rE.set(t,e))}return e}toString(){return this.cssText}};const sE=(e,t)=>{aE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=nE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},cE=aE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new oE("string"==typeof e?e:e+"",void 0,iE))(t)})(e):e
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/;var lE;const dE=window,uE=dE.trustedTypes,hE=uE?uE.emptyScript:"",pE=dE.reactiveElementPolyfillSupport,mE={toAttribute(e,t){switch(t){case Boolean:e=e?hE: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}},gE=(e,t)=>t!==e&&(t==t||e==e),fE={attribute:!0,type:String,converter:mE,reflect:!1,hasChanged:gE},_E="finalized";class vE 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=fE){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)||fE}static finalize(){if(this.hasOwnProperty(_E))return!1;this[_E]=!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(cE(e))}else void 0!==e&&t.push(cE(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 sE(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=fE){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:mE).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:mE;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.constructor.getPropertyOptions(e)).hasChanged||gE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}vE[_E]=!0,vE.elementProperties=new Map,vE.elementStyles=[],vE.shadowRootOptions={mode:"open"},null==pE||pE({ReactiveElement:vE}),(null!==(lE=dE.reactiveElementVersions)&&void 0!==lE?lE:dE.reactiveElementVersions=[]).push("1.6.3");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const yE=0,bE=Symbol();class wE{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===bE?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)=>gE(e,t[n]))):e!==t}}class xE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var CE=":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 ME=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??Ck(i),pending:()=>a?.inProgressFunc?.()??Ck(i),error:t=>{Gg(t),Sk(e,t)},complete:n})}`},kE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,SE=(e,t,n,a=!0)=>new wE(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(kE)?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}),EE=300;let $E=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=SE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===yE&&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?ME(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})],$E.prototype,"thumbnail",void 0),e([he({attribute:!1})],$E.prototype,"hass",void 0),$E=e([le("frigate-card-thumbnail-feature-thumbnail")],$E);let AE=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})],AE.prototype,"date",void 0),e([he({attribute:!1})],AE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],AE.prototype,"showCameraTitle",void 0),AE=e([le("frigate-card-thumbnail-feature-text")],AE);let zE=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(CE)}};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-event")],zE);let IE=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(CE)}};e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),e([he({attribute:!1})],IE.prototype,"cameraTitle",void 0),IE=e([le("frigate-card-thumbnail-details-recording")],IE);let TE=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&&(!nx.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`
${nx.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>`:nx.isEvent(this.media)||nx.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&&nx.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&&nx.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 xE(["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 $w(this.hass,this.cameraManager,this.media)}catch(e){Sk(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})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_download_control",void 0),e([he({attribute:!1})],TE.prototype,"seek",void 0),TE=e([le("frigate-card-thumbnail")],TE);let jE=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})],jE.prototype,"hass",void 0),e([he({attribute:!1})],jE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],jE.prototype,"cameraManager",void 0),e([he({attribute:!1})],jE.prototype,"config",void 0),e([he({attribute:!1})],jE.prototype,"fadeThumbnails",void 0),jE=e([le("frigate-card-thumbnail-carousel")],jE);var OE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const DE=document.createElement("template");DE.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 RE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(DE.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-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",RE);let PE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q`
<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})],PE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],PE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],PE.prototype,"open",void 0),e([he({attribute:!1})],PE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],PE.prototype,"empty",void 0),PE=e([le("frigate-card-drawer")],PE);let LE=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})],LE.prototype,"drawerIcons",void 0),LE=e([le("frigate-card-surround-basic")],LE);let NE=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-b390cfa1.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 xE(["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(OE)}};e([he({attribute:!1})],NE.prototype,"hass",void 0),e([he({attribute:!1})],NE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],NE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],NE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],NE.prototype,"cameraManager",void 0),e([he({attribute:!1})],NE.prototype,"cardWideConfig",void 0),NE=e([le("frigate-card-surround")],NE);var FE="Fri, 13 Dec 2024 16:12:40 GMT",VE="ed0bb99",HE="Fri, 13 Dec 2024 08:11:26 -0800";const BE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),qE="hass_web_proxy",UE=(e,t)=>`/api/${qE}/v${t??0}/?url=${encodeURIComponent(e)}`,WE=(e,t,n="media")=>(e=>e.config.components.includes(qE))(e)&&!!t[n];async function ZE(e,t,n){await e.callService(qE,"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 QE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,BE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let GE=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.6",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:VE,build_date:FE,commit_date:HE},...e&&{ha_version:e.config.version},integrations:{reolink:await QE("reolink",e),frigate:{...await QE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await QE(qE,e),motioneye:await QE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return xk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(OE)}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([pe()],GE.prototype,"_diagnostics",void 0),GE=e([le("frigate-card-diagnostics")],GE);let YE=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-e610f971.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-9024cb87.js"):e?.isViewerView()?import("./index-76cab2a3.js"):e?.is("image")?import("./image-1c1ebdfa.js"):e?.is("timeline")&&import("./timeline-c3ef17c4.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})],YE.prototype,"hass",void 0),e([he({attribute:!1})],YE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],YE.prototype,"cameraManager",void 0),e([he({attribute:!1})],YE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],YE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],YE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],YE.prototype,"rawConfig",void 0),e([he({attribute:!1})],YE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],YE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],YE.prototype,"hide",void 0),e([he({attribute:!1})],YE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],YE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],YE.prototype,"deviceRegistryManager",void 0),YE=e([le("frigate-card-views")],YE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.6`,"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 KE=class extends se{constructor(){super(...arguments),this._controller=new zx(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ix,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 zx.getConfigElement()}static getStubConfig(e,t){return zx.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>
${xk(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]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\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}};KE=e([le("frigate-card")],KE);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 as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,nw as a1,et as a2,aw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,ew as bQ,Xb as bR,Wk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,tw as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Yw as cP,kk as cQ,ze as cR,Kw as cS,df as cT,xk as cU,je as cV,Qg as cW,yw as cX,td as cY,Sk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,iw as d,ba as d$,My as d0,ve as d1,OE as d2,Vd as d3,nu as d4,c as d5,hx as d6,Qv as d7,px as d8,dx as d9,xx as dA,Mk as dB,U as dC,xf as dD,qw as dE,SE as dF,ME as dG,yf as dH,Vk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Mx as dU,Gy as dV,fx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,mx as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,Uw as dh,af as di,EE as dj,Sx as dk,Ck as dl,Aw as dm,nx as dn,hy as dp,qb as dq,Ub as dr,WE as ds,ZE as dt,Tb as du,UE as dv,Gw as dw,Xw as dx,Jw as dy,ex as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Hb as eB,Zv as eC,Fb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,Qw as eP,wE as eQ,me as eR,be as eS,Ob as eT,Gv as ea,Bk as eb,Hv as ec,rf as ed,Tv as ee,qk as ef,Iv as eg,zv as eh,jv as ei,Uk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,xw as f,Vb as g,Jb as h,Dv as i,Nb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Bb as v,Xi as w,q as x,er as y,Ji as z};