566 lines
362 KiB
JavaScript
566 lines
362 KiB
JavaScript
|
function e(e,t,n,i){var a,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(r<3?a(o):r>3?a(t,n,o):a(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}var t=window&&window.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},t.apply(this,arguments)};["angle-degree","area-acre","area-hectare","concentr-percent","digital-bit","digital-byte","digital-gigabit","digital-gigabyte","digital-kilobit","digital-kilobyte","digital-megabit","digital-megabyte","digital-petabyte","digital-terabit","digital-terabyte","duration-day","duration-hour","duration-millisecond","duration-minute","duration-month","duration-second","duration-week","duration-year","length-centimeter","length-foot","length-inch","length-kilometer","length-meter","length-mile-scandinavian","length-mile","length-millimeter","length-yard","mass-gram","mass-kilogram","mass-ounce","mass-pound","mass-stone","temperature-celsius","temperature-fahrenheit","volume-fluid-ounce","volume-gallon","volume-liter","volume-milliliter"].map((function(e){return e.replace(/^(.*?)-/,"")}));var n,i,a,r=window&&window.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},n(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=window&&window.__assign||function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o.apply(this,arguments)};function s(e){return e.substr(0,e.indexOf("."))}!function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="MISSING_LOCALE_DATA",t}r(t,e)}(Error),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"}(i||(i={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(a||(a={}));var c=["closed","locked","off"],l=function(e,t,n,i){i=i||{},n=null==n?{}:n;var a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return a.detail=n,e.dispatchEvent(a),a},d=function(e){l(window,"haptic",e)},u=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var i,a=s(t),r="group"===a?"homeassistant":a;switch(a){case"lock":i=n?"unlock":"lock";break;case"cover":i=n?"open_cover":"close_cover";break;default:i=n?"turn_on":"turn_off"}return e.callService(r,i,{entity_id:t})}(e,t,c.includes(e.states[t].state))},h=function(e,t,n,i){if(i||(i={action:"more-info"}),!i.confirmation||i.confirmation.exemptions&&i.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(d("warning"),confirm(i.confirmation.text||"Are you sure you want to "+i.action+"?")))switch(i.action){case"more-info":(n.entity||n.camera_image)&&l(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":i.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),l(window,"location-changed",{replace:n})}(0,i.navigation_path);break;case"url":i.url_path&&window.open(i.url_path);break;case"toggle":n.entity&&(u(t,n.entity),d("success"));break;case"call-service":if(!i.service)return void d("failure");var a=i.service.split(".",2);t.callService(a[0],a[1],i.service_data,i.target),d("success");break;case"fire-dom-event":l(e,"ll-custom",i)}};function m(e){return void 0!==e&&"none"!==e.action}var p=function(){var e=document.querySelector("home-assistant");if(e=(e=(e=(e=(e=(e=(e=(e=e&&e.shadowRoot)&&e.querySelector("home-assistant-main"))&&e.shadowRoot)&&e.querySelector("app
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2019 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/const f=window,g=f.ShadowRoot&&(void 0===f.ShadyCSS||f.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,v=Symbol(),_=new WeakMap;class y{constructor(e,t,n){if(this._$cssResult$=!0,n!==v)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(g&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=_.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&_.set(t,e))}return e}toString(){return this.cssText}}const b=e=>new y("string"==typeof e?e:e+"",void 0,v),w=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,i)=>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[i+1]),e[0]);return new y(n,e,v)},x=(e,t)=>{g?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),i=f.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=t.cssText,e.appendChild(n)}))},C=g?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return b(t)})(e):e
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/;var $;const k=window,E=k.trustedTypes,M=E?E.emptyScript:"",S=k.reactiveElementPolyfillSupport,T={toAttribute(e,t){switch(t){case Boolean:e=e?M: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}},A=(e,t)=>t!==e&&(t==t||e==e),z={attribute:!0,type:String,converter:T,reflect:!1,hasChanged:A};class j extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}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 i=this._$Ep(n,t);void 0!==i&&(this._$Ev.set(i,n),e.push(i))})),e}static createProperty(e,t=z){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,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||z}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!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(C(e))}else void 0!==e&&t.push(C(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}u(){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 x(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=z){var i;const a=this.constructor._$Ep(e,n);if(void 0!==a&&!0===n.reflect){const r=(void 0!==(null===(i=n.converter)||void 0===i?void 0:i.toAttribute)?n.converter:T).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(a):this.setAttribute(a,r),this._$El=null}}_$AK(e,t){var n;const i=this.constructor,a=i._$Ev.get(e);if(void 0!==a&&this._$El!==a){const e=i.getPropertyOptions(a),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:T;this._$El=a,this[a]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).h
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/
|
||
|
var O;j.finalized=!0,j.elementProperties=new Map,j.elementStyles=[],j.shadowRootOptions={mode:"open"},null==S||S({ReactiveElement:j}),(null!==($=k.reactiveElementVersions)&&void 0!==$?$:k.reactiveElementVersions=[]).push("1.6.1");const I=window,R=I.trustedTypes,D=R?R.createPolicy("lit-html",{createHTML:e=>e}):void 0,P=`lit$${(Math.random()+"").slice(9)}$`,L="?"+P,N=`<${L}>`,U=document,F=(e="")=>U.createComment(e),H=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Z=Array.isArray,q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,V=/-->/g,W=/>/g,B=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),Y=/'/g,Q=/"/g,G=/^(?:script|style|textarea|title)$/i,K=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),X=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),ee=new WeakMap,te=U.createTreeWalker(U,129,null,!1),ne=(e,t)=>{const n=e.length-1,i=[];let a,r=2===t?"<svg>":"",o=q;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===q?"!--"===c[1]?o=V:void 0!==c[1]?o=W:void 0!==c[2]?(G.test(c[2])&&(a=RegExp("</"+c[2],"g")),o=B):void 0!==c[3]&&(o=B):o===B?">"===c[0]?(o=null!=a?a:q,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?B:'"'===c[3]?Q:Y):o===Q||o===Y?o=B:o===V||o===W?o=q:(o=B,a=void 0);const u=o===B&&e[t+1].startsWith("/>")?" ":"";r+=o===q?n+N:l>=0?(i.push(s),n.slice(0,l)+"$lit$"+n.slice(l)+P+u):n+P+(-2===l?(i.push(void 0),t):u)}const s=r+(e[n]||"<?>")+(2===t?"</svg>":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==D?D.createHTML(s):s,i]};class ie{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,r=0;const o=e.length-1,s=this.parts,[c,l]=ne(e,t);if(this.el=ie.createElement(c,n),te.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(i=te.nextNode())&&s.length<o;){if(1===i.nodeType){if(i.hasAttributes()){const e=[];for(const t of i.getAttributeNames())if(t.endsWith("$lit$")||t.startsWith(P)){const n=l[r++];if(e.push(t),void 0!==n){const e=i.getAttribute(n.toLowerCase()+"$lit$").split(P),t=/([.?@])?(.*)/.exec(n);s.push({type:1,index:a,name:t[2],strings:e,ctor:"."===t[1]?ce:"?"===t[1]?de:"@"===t[1]?ue:se})}else s.push({type:6,index:a})}for(const t of e)i.removeAttribute(t)}if(G.test(i.tagName)){const e=i.textContent.split(P),t=e.length-1;if(t>0){i.textContent=R?R.emptyScript:"";for(let n=0;n<t;n++)i.append(e[n],F()),te.nextNode(),s.push({type:2,index:++a});i.append(e[t],F())}}}else if(8===i.nodeType)if(i.data===L)s.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(P,e+1));)s.push({type:7,index:a}),e+=P.length-1}a++}}static createElement(e,t){const n=U.createElement("template");return n.innerHTML=e,n}}function ae(e,t,n=e,i){var a,r,o,s;if(t===X)return t;let c=void 0!==i?null===(a=n._$Co)||void 0===a?void 0:a[i]:n._$Cl;const l=H(t)?void 0:t._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(r=null==c?void 0:c._$AO)||void 0===r||r.call(c,!1),void 0===l?c=void 0:(c=new l(e),c._$AT(e,n,i)),void 0!==i?(null!==(o=(s=n)._$Co)&&void 0!==o?o:s._$Co=[])[i]=c:n._$Cl=c),void 0!==c&&(t=ae(e,c._$AS(e,t.values),c,i)),t}class re{constructor(e,t){this.u=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(e){var t;const{el:{content:n},parts:i}=this._$AD,a=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:U).importNode(n,!0);te.currentNode=a;let r=te.nextNode(),o=0,s=0,c=i[0];for(;void 0!==c;){if(o===c.index){let t;2===c.type?t=new oe(r,r.nextSibling,this,e):1===c.type?t=new c.ctor(r,c.name,c.strings,this,e):6===c.type&&(t=new he(r,this,e)),this.u.push(t),c=i[++s]}o!==(null==c?void 0:c.index)&&(r=te.nextNode(),o++)}return a}p(e){let t=0;for(const n of this.u)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class oe{constructor(e,t,n,i){var a;this.type=2,this._$AH=J,this._$AN=void 0,th
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/
|
||
|
var pe,fe;class ge extends j{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const n=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=n.firstChild),n}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{var i,a;const r=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:t;let o=r._$litPart$;if(void 0===o){const e=null!==(a=null==n?void 0:n.renderBefore)&&void 0!==a?a:null;r._$litPart$=o=new oe(t.insertBefore(F(),e),e,void 0,null!=n?n:{})}return o._$AI(e),o})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return X}}ge.finalized=!0,ge._$litElement$=!0,null===(pe=globalThis.litElementHydrateSupport)||void 0===pe||pe.call(globalThis,{LitElement:ge});const ve=globalThis.litElementPolyfillSupport;null==ve||ve({LitElement:ge}),(null!==(fe=globalThis.litElementVersions)&&void 0!==fe?fe:globalThis.litElementVersions=[]).push("3.2.2");
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/
|
||
|
const _e=e=>t=>"function"==typeof t?((e,t)=>(customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:n,elements:i}=t;return{kind:n,elements:i,finisher(t){customElements.define(e,t)}}})(e,t)
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/,ye=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(n){n.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(n){n.createProperty(t.key,e)}};function be(e){return(t,n)=>void 0!==n?((e,t,n)=>{t.constructor.createProperty(n,e)})(e,t,n):ye(e,t)
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/}function we(e){return be({...e,state:!0})}
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2021 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/var xe;null===(xe=window.HTMLSlotElement)||void 0===xe||xe.prototype.assignedElements;
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/
|
||
|
const Ce={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$e=e=>(...t)=>({_$litDirective$:e,values:t});class ke{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 Ee=$e(class extends ke{constructor(e){var t;if(super(e),e.type!==Ce.ATTRIBUTE||"class"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.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]){var n,i;if(void 0===this.nt){this.nt=new Set,void 0!==e.strings&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!(null===(n=this.st)||void 0===n?void 0:n.has(e))&&this.nt.add(e);return this.render(t)}const a=e.element.classList;this.nt.forEach((e=>{e in t||(a.remove(e),this.nt.delete(e))}));for(const e in t){const n=!!t[e];n===this.nt.has(e)||(null===(i=this.st)||void 0===i?void 0:i.has(e))||(n?(a.add(e),this.nt.add(e)):(a.remove(e),this.nt.delete(e)))}return X}}),Me=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Se=e=>void 0===e.strings,Te={},Ae=(e,t=Te)=>e._$AH=t
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/,ze=(e,t)=>{var n,i;const a=e._$AN;if(void 0===a)return!1;for(const e of a)null===(i=(n=e)._$AO)||void 0===i||i.call(n,t,!1),ze(e,t);return!0},je=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===(null==n?void 0:n.size))},Oe=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),De(t)}};
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2020 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/function Ie(e){void 0!==this._$AN?(je(this),this._$AM=e,Oe(this)):this._$AM=e}function Re(e,t=!1,n=0){const i=this._$AH,a=this._$AN;if(void 0!==a&&0!==a.size)if(t)if(Array.isArray(i))for(let e=n;e<i.length;e++)ze(i[e],!1),je(i[e]);else null!=i&&(ze(i,!1),je(i));else ze(this,e)}const De=e=>{var t,n,i,a;e.type==Ce.CHILD&&(null!==(t=(i=e)._$AP)&&void 0!==t||(i._$AP=Re),null!==(n=(a=e)._$AQ)&&void 0!==n||(a._$AQ=Ie))};class Pe extends ke{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Oe(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,i;e!==this.isConnected&&(this.isConnected=e,e?null===(n=this.reconnected)||void 0===n||n.call(this):null===(i=this.disconnected)||void 0===i||i.call(this)),t&&(ze(this,e),je(this))}setValue(e){if(Se(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 Le=()=>new Ne;class Ne{}const Ue=new WeakMap,Fe=$e(class extends Pe{render(e){return J}update(e,[t]){var n;const i=t!==this.Y;return i&&void 0!==this.Y&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.Y=t,this.dt=null===(n=e.options)||void 0===n?void 0:n.host,this.rt(this.ct=e.element)),J}rt(e){var t;if("function"==typeof this.Y){const n=null!==(t=this.dt)&&void 0!==t?t:globalThis;let i=Ue.get(n);void 0===i&&(i=new WeakMap,Ue.set(n,i)),void 0!==i.get(this.Y)&&this.Y.call(this.dt,void 0),i.set(this.Y,e),void 0!==e&&this.Y.call(this.dt,e)}else this.Y.value=e}get lt(){var e,t,n;return"function"==typeof this.Y?null===(t=Ue.get(null!==(e=this.dt)&&void 0!==e?e:globalThis))||void 0===t?void 0:t.get(this.Y):null===(n=this.Y)||void 0===n?void 0:n.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),He=$e(class extends ke{constructor(e){var t;if(super(e),e.type!==Ce.ATTRIBUTE||"style"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.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 i=e[n];return null==i?t:t+`${n=n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.vt){this.vt=new Set;for(const e in t)this.vt.add(e);return this.render(t)}this.vt.forEach((e=>{null==t[e]&&(this.vt.delete(e),e.includes("-")?n.removeProperty(e):n[e]="")}));for(const e in t){const i=t[e];null!=i&&(this.vt.add(e),e.includes("-")?n.setProperty(e,i):n[e]=i)}return X}});
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/function Ze(e,t){return e===t||e!=e&&t!=t}function qe(e,t){for(var n=e.length;n--;)if(Ze(e[n][0],t))return n;return-1}var Ve=Array.prototype.splice;function We(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}We.prototype.clear=function(){this.__data__=[],this.size=0},We.prototype.delete=function(e){var t=this.__data__,n=qe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ve.call(t,n,1),--this.size,!0)},We.prototype.get=function(e){var t=this.__data__,n=qe(t,e);return n<0?void 0:t[n][1]},We.prototype.has=function(e){return qe(this.__data__,e)>-1},We.prototype.set=function(e,t){var n=this.__data__,i=qe(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Be="object"==typeof global&&global&&global.Object===Object&&global,Ye="object"==typeof self&&self&&self.Object===Object&&self,Qe=Be||Ye||Function("return this")(),Ge=Qe.Symbol,Ke=Object.prototype,Xe=Ke.hasOwnProperty,Je=Ke.toString,et=Ge?Ge.toStringTag:void 0;var tt=Object.prototype.toString;var nt="[object Null]",it="[object Undefined]",at=Ge?Ge.toStringTag:void 0;function rt(e){return null==e?void 0===e?it:nt:at&&at in Object(e)?function(e){var t=Xe.call(e,et),n=e[et];try{e[et]=void 0;var i=!0}catch(e){}var a=Je.call(e);return i&&(t?e[et]=n:delete e[et]),a}(e):function(e){return tt.call(e)}(e)}function ot(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var st="[object AsyncFunction]",ct="[object Function]",lt="[object GeneratorFunction]",dt="[object Proxy]";function ut(e){if(!ot(e))return!1;var t=rt(e);return t==ct||t==lt||t==st||t==dt}var ht,mt=Qe["__core-js_shared__"],pt=(ht=/[^.]+$/.exec(mt&&mt.keys&&mt.keys.IE_PROTO||""))?"Symbol(src)_1."+ht:"";var ft=Function.prototype.toString;function gt(e){if(null!=e){try{return ft.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var vt=/^\[object .+?Constructor\]$/,_t=Function.prototype,yt=Object.prototype,bt=_t.toString,wt=yt.hasOwnProperty,xt=RegExp("^"+bt.call(wt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ct(e){return!(!ot(e)||(t=e,pt&&pt in t))&&(ut(e)?xt:vt).test(gt(e));var t}function $t(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ct(n)?n:void 0}var kt=$t(Qe,"Map"),Et=$t(Object,"create");var Mt="__lodash_hash_undefined__",St=Object.prototype.hasOwnProperty;var Tt=Object.prototype.hasOwnProperty;var At="__lodash_hash_undefined__";function zt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function jt(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 Ot(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}zt.prototype.clear=function(){this.__data__=Et?Et(null):{},this.size=0},zt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},zt.prototype.get=function(e){var t=this.__data__;if(Et){var n=t[e];return n===Mt?void 0:n}return St.call(t,e)?t[e]:void 0},zt.prototype.has=function(e){var t=this.__data__;return Et?void 0!==t[e]:Tt.call(t,e)},zt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Et&&void 0===t?At:t,this},Ot.prototype.clear=function(){this.size=0,this.__data__={hash:new zt,map:new(kt||We),string:new zt}},Ot.prototype.delete=function(e){var t=jt(this,e).delete(e);return this.size-=t?1:0,t},Ot.prototype.get=function(e){return jt(this,e).get(e)},Ot.prototype.has=function(e){return jt(this,e).has(e)},Ot.prototype.set=function(e,t){var n=jt(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};var It=200;function Rt(e){var t=this.__data__=new We(e);this.size=t.size}Rt.prototype.clear=function(){this.__data__=new We,this.size=0},Rt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Rt.prototype.get=function(e){return this.__data__.get(e)},Rt.prototype.has=function(e){return this.__data__.has(e)},Rt.
|
||
|
<div class="message padded">
|
||
|
<div class="icon">
|
||
|
<ha-icon icon="${e}"> </ha-icon>
|
||
|
</div>
|
||
|
<div class="contents">
|
||
|
<span class="${Ee(t)}">
|
||
|
${this.message?K`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""}
|
||
|
</span>
|
||
|
${this.context&&"string"!=typeof this.context?K`<pre>${JSON.stringify(this.context,null,2)}</pre>`:""}
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>`}static get styles(){return b(yv)}};e([be({attribute:!1})],bv.prototype,"message",void 0),e([be({attribute:!1})],bv.prototype,"context",void 0),e([be({attribute:!1})],bv.prototype,"icon",void 0),e([be({attribute:!0,type:Boolean})],bv.prototype,"dotdotdot",void 0),bv=e([_e("frigate-card-message")],bv);let wv=class extends ge{render(){if(this.message)return K` <frigate-card-message
|
||
|
.message=${K` ${this.message.message}.
|
||
|
<a href="${Ys}"> ${Pm("error.troubleshooting")}</a>.`}
|
||
|
.icon=${"mdi:alert-circle"}
|
||
|
.context=${this.message.context}
|
||
|
.dotdotdot=${this.message.dotdotdot}
|
||
|
>
|
||
|
</frigate-card-message>`}static get styles(){return b(yv)}};e([be({attribute:!1})],wv.prototype,"message",void 0),wv=e([_e("frigate-card-error-message")],wv);let xv=class extends ge{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return K` <div class="message vertical">
|
||
|
${this.animated?K`<ha-circular-progress active="true" size="${this.size}">
|
||
|
</ha-circular-progress>`:K`<ha-icon icon="mdi:timer-sand"></ha-icon>`}
|
||
|
${this.message?K`<span>${this.message}</span>`:K``}
|
||
|
</div>`}static get styles(){return b(yv)}};function Cv(e){return"error"===e.type?K` <frigate-card-error-message
|
||
|
.message=${e}
|
||
|
></frigate-card-error-message>`:K` <frigate-card-message
|
||
|
.message=${e.message}
|
||
|
.icon=${e.icon}
|
||
|
.context=${e.context}
|
||
|
.dotdotdot=${e.dotdotdot}
|
||
|
></frigate-card-message>`}function $v(e){return K`
|
||
|
<frigate-card-progress-indicator
|
||
|
class="${Ee(e?.classes??{})}"
|
||
|
.size=${e?.size}
|
||
|
${e?.componentRef?Fe(e.componentRef):""}
|
||
|
.message=${e?.message||""}
|
||
|
.animated=${e?.cardWideConfig?.performance?.features.animated_progress_indicator??!0}
|
||
|
>
|
||
|
</frigate-card-progress-indicator>
|
||
|
`}function kv(e,t,n,i){If(e,"message",{message:t,type:n,icon:i?.icon,context:i?.context})}function Ev(e,t,n){kv(e,t,"error",{context:n?.context})}function Mv(e,t){t instanceof Error&&Ev(e,t.message,{...t instanceof vu&&{context:t.context}})}function Sv(e,t,n){return null==e?e:function(e,t,n,i){if(!ot(e))return e;for(var a=-1,r=(t=gg(t,e)).length,o=r-1,s=e;null!=s&&++a<r;){var c=_g(t[a]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(a!=o){var d=s[c];void 0===(l=i?i(d,c,s):void 0)&&(l=ot(d)?d:tn(t[a+1])?[]:{})}Nt(s,c,l),s=s[c]}return e}(e,t,n)}e([be({attribute:!1})],xv.prototype,"message",void 0),e([be({attribute:!1})],xv.prototype,"animated",void 0),e([be({attribute:!1})],xv.prototype,"size",void 0),xv=e([_e("frigate-card-progress-indicator")],xv);const Tv=(e,t,n)=>{Sv(e,t,n)},Av=(e,t,n)=>kg(e,t,n),zv=(e,t)=>{let n=t,i=e;if(t&&t.split&&t.includes(".")){const a=t.split(".");n=a[a.length-1],i=Av(e,a.slice(0,-1).join("."))}i&&"object"==typeof i&&delete i[n]},jv=function(e){let t=!1;for(let n=0;n<Qv.length;n++)t=Qv[n](e)||t;return t},Ov=function(e){return jv(Iv(e))},Iv=e=>Gi(e),Rv=function(e,t,n){return i=>{let a=e(i);return"number"!=typeof a||(a=t?Math.max(t,a):a,a=n?Math.min(n,a):a),a}},Dv=function(e){if("number"!=typeof e)return"string"!=typeof e?null:(e=e.replace(/px$/i,""),isNaN(e)?null:Number(e))},Pv=function(e){return null},Lv=(e,t)=>e.replace("#",`[${t.toString()}]`),Nv=function(e,t,n){return function(i){return((e,t,n,i)=>{const a=Av(e,t);if(void 0===a)return!1;const r=i?.transform?i.transform(a):a;return!(t===n&&Aa(a,r)||(null===r?i?.keepOriginal||(zv(e,t),0):void 0===r||(i?.keepOriginal||zv(e,t),Tv(e,n,r),0)))})(i,e,t,n)}},Uv=function(e,t,n){return function(i){let a=Nv(e,t,n)(i);return a=Zv(Yd,Nv(e,t,n),(e=>e.overrides))(i)||a,a}},Fv=function(e,t){return Uv(e,e,{transform:t})},Hv=function(e,t){return Nv(e,e,{transform:t})},Zv=function(e,t,n){return function(i){let a=!1;const r=Av(i,e);return Array.isArray(r)&&r.forEach((e=>{const i=n?n(e):e;i&&"object"==typeof i&&(a=t(i)||a)})),a}},qv=function(e){if("object"!=typeof e)return"boolean"!=typeof e?null:{enabled:e}},Vv=e=>{const t=`${e}.show_controls`;return function(n){let i=!1;return i=Uv(t,`${e}.show_favorite_control`,{keepOriginal:!0})(n)||i,i=Uv(t,`${e}.show_timeline_control`,{keepOriginal:!0})(n)||i,Fv(t,Pv)(n)||i}},Wv=(e,t)=>{const n=i=>{let a=!1;if(i&&"object"==typeof i){const r=t?t(i):i;r&&(a=e(r)||a),Array.isArray(i)?i.filter((e=>"object"==typeof e)).forEach((e=>{a=n(e)||a})):Object.keys(i).filter((e=>"object"==typeof i[e])).forEach((e=>{a=n(i[e])||a}))}return a};return n},Bv=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),Yv=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),Qv=[Fv(Rl,Rv(Dv,75,cu)),Fv("event_viewer.controls.thumbnails.size",Rv(Dv,75,cu)),Fv(jl,Rv(Dv,su)),Fv("event_viewer.controls.next_previous.size",Rv(Dv,su)),Fv(Ad,Rv(Dv,su)),Fv("event_gallery.min_columns",Pv),function(e){let t=!1;return t=Uv("menu.mode",Td,{transform:e=>{if("string"==typeof e){const t=e.match(/^(hover|hidden|overlay|above|below|none)/);if(t)switch(t[1]){case"hover":case"hidden":case"overlay":case"none":return t[1];case"above":case"below":return"outside"}}},keepOriginal:!0})(e)||t,t=Uv("menu.mode",Sd,{transform:e=>{if("string"==typeof e){const t=e.match(/(above|below|left|right|top|bottom)$/);if(t)switch(t[1]){case"left":case"right":case"top":case"bottom":return t[1];case"above":return"top";case"below":return"bottom"}}},keepOriginal:!0})(e)||t,Fv("menu.mode",Pv)(e)||t},Fv(Rd,qv),Fv(jd,qv),Fv(Nd,qv),Fv(Od,qv),Fv(Fd,qv),Fv(Ld,qv),Fv(Id,qv),Fv("menu.buttons.frigate_ui",qv),Fv(Pd,qv),Hv(Jl,(e=>"boolean"==typeof e?e?"all":"never":void 0)),Hv(Tl,(e=>"boolean"==typeof e?e?"all":"never":void 0)),Hv("event_viewer.auto_play",(e=>"boolean"==typeof e?e?"all":"never":void 0)),Hv("event_viewer.auto_unmute",(e=>"boolean"==typeof e?e?"all":"never":void 0)),Uv("event_viewer",Qc),Zv(Qs,Nv("camera_name","frigate
|
||
|
.hass=${this.hass}
|
||
|
.conditionControllerEpoch=${this.conditionControllerEpoch}
|
||
|
.elements=${this.elements}
|
||
|
>
|
||
|
</frigate-card-elements-core>`}static get styles(){return b(":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([be({attribute:!1})],e_.prototype,"hass",void 0),e([be({attribute:!1})],e_.prototype,"conditionControllerEpoch",void 0),e([be({attribute:!1})],e_.prototype,"elements",void 0),e_=e([_e("frigate-card-elements")],e_);let t_=class extends ge{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 Gv(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config.conditions))return K` <frigate-card-elements-core
|
||
|
.hass=${this.hass}
|
||
|
.elements=${this._config.elements}
|
||
|
>
|
||
|
</frigate-card-elements-core>`}};e([be({attribute:!1,hasChanged:()=>!0})],t_.prototype,"hass",void 0),t_=e([_e("frigate-card-conditional")],t_);class n_ extends ge{constructor(){super(...arguments),this._config=null}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&If(this,"menu-add",this._config)}disconnectedCallback(){this._config&&If(this,"menu-remove",this._config),super.disconnectedCallback()}}e([we()],n_.prototype,"_config",void 0);let i_=class extends n_{};i_=e([_e("frigate-card-menu-icon")],i_);let a_=class extends n_{};a_=e([_e("frigate-card-menu-state-icon")],a_);let r_=class extends n_{};r_=e([_e("frigate-card-menu-submenu")],r_);let o_=class extends n_{};o_=e([_e("frigate-card-menu-submenu-select")],o_);let s_=class extends ge{constructor(){super(...arguments),this._config=null}setConfig(e){this._config=e}willUpdate(e){e.has("_config")&&this.setAttribute("data-orientation",this._config?.orientation??"vertical")}_actionHandler(e,t){e.stopPropagation();const n=e.detail.action,i=mm(n,t);t&&i&&this.hass&&pm(this,this.hass,t,n,i)}render(){if(!this._config)return;const e=(e,t,n)=>{const i=gm(n?.hold_action),a=gm(n?.double_tap_action);return K`<ha-icon
|
||
|
class=${Ee({[e]:!0,disabled:!n})}
|
||
|
icon=${t}
|
||
|
.actionHandler=${wm({hasHold:i,hasDoubleClick:a})}
|
||
|
.title=${Pm(`elements.ptz.${e}`)}
|
||
|
@action=${e=>this._actionHandler(e,n)}
|
||
|
></ha-icon>`};return K` <div class="ptz">
|
||
|
<div class="ptz-move">
|
||
|
${e("right","mdi:arrow-right",this._config.actions_right)}
|
||
|
${e("left","mdi:arrow-left",this._config.actions_left)}
|
||
|
${e("up","mdi:arrow-up",this._config.actions_up)}
|
||
|
${e("down","mdi:arrow-down",this._config.actions_down)}
|
||
|
</div>
|
||
|
${this._config.actions_zoom_in||this._config.actions_zoom_out?K` <div class="ptz-zoom">
|
||
|
${e("zoom_in","mdi:plus",this._config.actions_zoom_in)}
|
||
|
${e("zoom_out","mdi:minus",this._config.actions_zoom_out)}
|
||
|
</div>`:K``}
|
||
|
${this._config.actions_home?K`
|
||
|
<div class="ptz-home">
|
||
|
${e("home","mdi:home",this._config.actions_home)}
|
||
|
</div>
|
||
|
`:K``}
|
||
|
</div>`}static get styles(){return b(":host {\n position: relative;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};e([be({attribute:!1})],s_.prototype,"hass",void 0),e([we()],s_.prototype,"_config",void 0),s_=e([_e("frigate-card-ptz")],s_);
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/
|
||
|
const c_=e=>null!=e?e:J;const l_="m 4.8759466,22.743573 c 0.0866,0.69274 0.811811,1.16359 0.37885,1.27183 -0.43297,0.10824 -2.32718,-3.43665 -2.7601492,-4.95202 -0.4329602,-1.51538 -0.6764993,-3.22017 -0.5682593,-4.19434 0.1082301,-0.97417 5.7097085,-2.48955 5.7097085,-2.89545 0,-0.4059 -1.81304,-0.0271 -1.89422,-0.35178 -0.0812,-0.32472 1.36925,-0.12989 1.75892,-0.64945 0.60885,-0.81181 1.3800713,-0.6765 1.8671505,-1.1094696 0.4870902,-0.4329599 1.0824089,-2.0836399 1.1906589,-2.7871996 0.108241,-0.70357 -1.0824084,-1.51538 -1.4071389,-2.05658 -0.3247195,-0.54121 0.7035702,-0.92005 3.1931099,-1.94834 2.48954,-1.02829 10.39114,-3.30134994 10.49938,-3.03074994 0.10824,0.27061 -2.59779,1.40713994 -4.492,2.11069994 -1.89422,0.70357 -4.97909,2.05658 -4.97909,2.43542 0,0.37885 0.16236,0.67651 0.0541,1.54244 -0.10824,0.86593 -0.12123,1.2702597 -0.32472,1.8400997 -0.1353,0.37884 -0.2706,1.27183 0,2.0836295 0.21648,0.64945 0.92005,1.13653 1.24477,1.24478 0.2706,0.018 1.01746,0.0433 1.8401,0 1.02829,-0.0541 2.48954,0.0541 2.48954,0.32472 0,0.2706 -2.21894,0.10824 -2.21894,0.48708 0,0.37885 2.27306,-0.0541 2.21894,0.32473 -0.0541,0.37884 -1.89422,0.21648 -2.86839,0.21648 -0.77933,0 -1.93031,-0.0361 -2.43542,-0.21648 l -0.10824,0.37884 c -0.18038,0 -0.55744,0.10824 -0.94711,0.10824 -0.48708,0 -0.51414,0.16236 -1.40713,0.16236 -0.892989,0 -0.622391,-0.0541 -1.4341894,-0.10824 -0.81181,-0.0541 -3.842561,2.27306 -4.383761,3.03075 -0.54121,0.75768 -0.21649,2.59778 -0.21649,3.43665 0,0.75379 -0.10824,2.43542 0,3.30135 z";const d_=(e,t,n)=>{const i=e.states[t],a=n?.state?n.state:i?i.state:null;if(!a)return null;const r=s(t),o=i?i.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${a}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${a}`)||e.localize(`component.${r}.state._.${a}`)||a};let u_=class extends ge{_renderItem(e){if(!this.hass)return;const t=gp(this.hass,{...e});return K`
|
||
|
<mwc-list-item
|
||
|
style="${He(t.style||{})}"
|
||
|
graphic=${c_(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=${wm({hasHold:gm(e.hold_action),hasDoubleClick:gm(e.double_tap_action)})}
|
||
|
>
|
||
|
<span>${t.title||""}</span>
|
||
|
${e.subtitle?K`<span slot="secondary">${e.subtitle}</span>`:""}
|
||
|
${(e=>e.icon?K` <ha-icon
|
||
|
style="${He(e.style||{})}"
|
||
|
data-domain=${c_(e.data_domain)}
|
||
|
data-state=${c_(e.data_state)}
|
||
|
slot="graphic"
|
||
|
icon="${e.icon||""}"
|
||
|
>
|
||
|
</ha-icon>`:K``)(t)}
|
||
|
</mwc-list-item>
|
||
|
`}render(){return this.submenu?K`
|
||
|
<ha-button-menu
|
||
|
corner=${"BOTTOM_LEFT"}
|
||
|
@closed=${e=>e.stopPropagation()}
|
||
|
@click=${e=>vm(e)}
|
||
|
>
|
||
|
<ha-icon-button
|
||
|
style="${He(this.submenu.style||{})}"
|
||
|
class="button"
|
||
|
slot="trigger"
|
||
|
.label=${this.submenu.title||""}
|
||
|
.actionHandler=${wm({allowPropagation:!0,hasHold:gm(this.submenu.hold_action),hasDoubleClick:gm(this.submenu.double_tap_action)})}
|
||
|
>
|
||
|
<ha-icon icon="${this.submenu.icon}"></ha-icon>
|
||
|
</ha-icon-button>
|
||
|
${this.submenu.items.map(this._renderItem.bind(this))}
|
||
|
</ha-button-menu>
|
||
|
`:K``}static get styles(){return b("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-but
|
||
|
.hass=${this.hass}
|
||
|
.submenu=${this._generatedSubmenu}
|
||
|
></frigate-card-submenu>`}};var m_;e([be({attribute:!1})],h_.prototype,"hass",void 0),e([be({attribute:!1})],h_.prototype,"submenuSelect",void 0),e([be({attribute:!1})],h_.prototype,"entityRegistryManager",void 0),e([we()],h_.prototype,"_optionTitles",void 0),h_=e([_e("frigate-card-submenu-select")],h_);let p_=m_=class extends ge{constructor(){super(...arguments),this.expanded=!1,this.buttons=[]}set menuConfig(e){this._menuConfig=e,e&&this.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this.setAttribute("data-style",e.style),this.setAttribute("data-position",e.position),this.setAttribute("data-alignment",e.alignment)}static isHidingMenu(e){return"hidden"===e?.style??!1}toggleMenu(){this._isHidingMenu()&&(this.expanded=!this.expanded)}_isHidingMenu(){return m_.isHidingMenu(this._menuConfig)}_isMenuToggleAction(e){if(!e)return!1;const t=um(e);return!!t&&"menu_toggle"==t.frigate_card_action}_actionHandler(e,t){if(!e)return;e.detail.config&&(t=e.detail.config),e.stopPropagation();const n=e.detail.action;let i=mm(n,t);if(!t||!n)return;let a=!1,r=!1;if(Array.isArray(i)){const e=i.length;i=i.filter((e=>!this._isMenuToggleAction(e))),i.length!=e&&(r=!0),i.length&&(a=pm(this,this.hass,t,n,i))}else this._isMenuToggleAction(i)?r=!0:a=pm(this,this.hass,t,n,i);this._isHidingMenu()&&(r?this.expanded=!this.expanded:a&&(this.expanded=!1))}willUpdate(e){const t=this._menuConfig?.style,n=(e,n)=>{if("hidden"===t){if(e.icon===nu)return-1;if(n.icon===nu)return 1}return void 0===e.priority||void 0!==n.priority&&n.priority>e.priority?1:void 0===n.priority||void 0!==e.priority&&n.priority<e.priority?-1:0};(e.has("_menuConfig")||e.has("buttons"))&&this.buttons.sort(n)}_renderButton(e){if("custom:frigate-card-menu-submenu"===e.type)return K` <frigate-card-submenu
|
||
|
.hass=${this.hass}
|
||
|
.submenu=${e}
|
||
|
@action=${this._actionHandler.bind(this)}
|
||
|
>
|
||
|
</frigate-card-submenu>`;if("custom:frigate-card-menu-submenu-select"===e.type)return K` <frigate-card-submenu-select
|
||
|
.hass=${this.hass}
|
||
|
.submenuSelect=${e}
|
||
|
.entityRegistryManager=${this.entityRegistryManager}
|
||
|
@action=${this._actionHandler.bind(this)}
|
||
|
>
|
||
|
</frigate-card-submenu-select>`;let t={...e};const n=t.icon===nu?l_:"";this.hass&&"custom:frigate-card-menu-state-icon"===e.type&&(t=gp(this.hass,t));const i=gm(e.hold_action),a=gm(e.double_tap_action);return K` <ha-icon-button
|
||
|
data-domain=${c_(t.data_domain)}
|
||
|
data-state=${c_(t.data_state)}
|
||
|
class="${Ee({button:!0})}"
|
||
|
style="${He(t.style||{})}"
|
||
|
.actionHandler=${wm({hasHold:i,hasDoubleClick:a})}
|
||
|
.label=${t.title||""}
|
||
|
@action=${t=>this._actionHandler(t,e)}
|
||
|
>
|
||
|
${n?K`<ha-svg-icon .path="${n}"></ha-svg-icon>`:K`<ha-icon
|
||
|
icon="${t.icon||"mdi:gesture-tap-button"}"
|
||
|
></ha-icon>`}
|
||
|
</ha-icon-button>`}render(){if(!this._menuConfig)return;const e=this._menuConfig.style;if("none"===e)return;const t=("hidden"!==e||this.expanded?this.buttons.filter((e=>!e.alignment||"matching"===e.alignment)):this.buttons.filter((e=>e.icon===nu))).filter((e=>!1!==e.enabled)),n="hidden"!==e||this.expanded?this.buttons.filter((e=>"opposing"===e.alignment&&!1!==e.enabled)):[],i={flex:String(t.length)},a={flex:String(n.length)};return K` <div class="matching" style="${He(i)}">
|
||
|
${t.map((e=>this._renderButton(e)))}
|
||
|
</div>
|
||
|
<div class="opposing" style="${He(a)}">
|
||
|
${n.map((e=>this._renderButton(e)))}
|
||
|
</div>`}static get styles(){return b('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
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2017 Google LLC
|
||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
*/class fy{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const i="object"==typeof t?t:{task:t,args:n};this.t=i.task,this.h=i.args,void 0!==i.autoRun&&(this.autoRun=i.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,i;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 a=++this.o;try{n=await this.t(e)}catch(e){i=e}this.o===a&&(n===py?this.status=0:(void 0===i?(this.status=2,this.l(n)):(this.status=3,this.u(i)),this.m=n,this._=i),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,i,a;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===(i=e.complete)||void 0===i?void 0:i.call(e,this.value);case 3:return null===(a=e.error)||void 0===a?void 0:a.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)=>A(e,t[n]))):e!==t}}const gy=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,vy=(e,t,n,i=!0)=>new fy(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const i=t();return e&&i&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(gy)?t:new Promise(((n,i)=>{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=>i(e),t.readAsDataURL(e)})):i()})):null)(i,n):null},autoRun:i});class _y{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)}}const yy=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,i=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!i)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},by=async(e,t,n)=>{const i=await t.getMediaDownloadPath(e,n);if(!i)throw new vu(Pm("error.download_no_media"));let a=i.endpoint;if(i.sign){let t;try{t=await lp(e,i.endpoint)}catch(e){Nf(e)}if(!t)throw new vu(Pm("error.download_sign_failed"));a=t}yy(a)},wy=300;let xy=class extends ge{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=vy(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===my&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){if(!this._embedThumbnailTask)return;const e=K`<ha-icon
|
||
|
icon="mdi:image-off"
|
||
|
title=${Pm("thumbnail.no_thumbnail")}
|
||
|
></ha-icon> `;return K`${this.thumbnail?hy(this,this._embedThumbnailTask,(e=>e?K`<img src="${e}" />`:K``),{inProgressFunc:()=>e}):e} `}static get styles(){return b(":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 max-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([be({attribute:!1})],xy.prototype,"thumbnail",void 0),e([be({attribute:!1})],xy.prototype,"hass",void 0),xy=e([_e("frigate-card-thumbnail-feature-event")],xy);let Cy=class extends ge{render(){if(this.date)return K`
|
||
|
<div class="title">${Of(this.date,"HH:mm")}</div>
|
||
|
<div class="subtitle">${Of(this.date,"MMM do")}</div>
|
||
|
${this.cameraTitle?K`<div class="camera">${this.cameraTitle}</div>`:K``}
|
||
|
`}static get styles(){return b(":host {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n aspect-ratio: 1/1;\n overflow: hidden;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n padding: 10px;\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 box-sizing: border-box;\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([be({attribute:!1})],Cy.prototype,"date",void 0),e([be({attribute:!1})],Cy.prototype,"cameraTitle",void 0),Cy=e([_e("frigate-card-thumbnail-feature-recording")],Cy);let $y=class extends ge{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),i=n?Ff(n):null,a=this.media.getEndTime(),r=n&&a?qf(n,a):null,o=this.media.inProgress()?Pm("event.in_progress"):null,s=Rf(this.media.getWhat()?.join(", "))??null,c=Rf(this.media.getWhere()?.join(", "))??null,l=Rf(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Of(this.seek,"HH:mm:ss"):null;return K`
|
||
|
${d?K` <div class="title">
|
||
|
<span title=${d}>${d}</span>
|
||
|
${t?K`<span title="${t}">${t}</span>`:""}
|
||
|
</div>`:""}
|
||
|
<div class="details">
|
||
|
${i?K` <div>
|
||
|
<ha-icon
|
||
|
title=${Pm("event.start")}
|
||
|
.icon=${"mdi:calendar-clock-outline"}
|
||
|
></ha-icon>
|
||
|
<span title="${i}">${i}</span>
|
||
|
</div>
|
||
|
${r||o?K` <div>
|
||
|
<ha-icon
|
||
|
title=${Pm("event.duration")}
|
||
|
.icon=${"mdi:clock-outline"}
|
||
|
></ha-icon>
|
||
|
${r?K`<span title="${r}">${r}</span>`:""}
|
||
|
${o?K`<span title="${o}">${o}</span>`:""}
|
||
|
</div>`:""}`:""}
|
||
|
${this.cameraTitle?K` <div>
|
||
|
<ha-icon title=${Pm("event.camera")} .icon=${"mdi:cctv"}></ha-icon>
|
||
|
<span title="${this.cameraTitle}">${this.cameraTitle}</span>
|
||
|
</div>`:""}
|
||
|
${c?K` <div>
|
||
|
<ha-icon
|
||
|
title=${Pm("event.where")}
|
||
|
.icon=${"mdi:map-marker-outline"}
|
||
|
></ha-icon>
|
||
|
<span title="${c}">${c}</span>
|
||
|
</div>`:K``}
|
||
|
${l?K` <div>
|
||
|
<ha-icon title=${Pm("event.tag")} .icon=${"mdi:tag"}></ha-icon>
|
||
|
<span title="${l}">${l}</span>
|
||
|
</div>`:K``}
|
||
|
${u?K` <div>
|
||
|
<ha-icon
|
||
|
title=${Pm("event.seek")}
|
||
|
.icon=${"mdi:clock-fast"}
|
||
|
></ha-icon>
|
||
|
<span title="${u}">${u}</span>
|
||
|
</div>`:K``}
|
||
|
</div>
|
||
|
`}static get styles(){return b(uy)}};e([be({attribute:!1})],$y.prototype,"media",void 0),e([be({attribute:!1})],$y.prototype,"seek",void 0),e([be({attribute:!1})],$y.prototype,"cameraTitle",void 0),$y=e([_e("frigate-card-thumbnail-details-event")],$y);let ky=class extends ge{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Ff(e):null,n=this.media.getEndTime(),i=e&&n?qf(e,n):null,a=this.media.inProgress()?Pm("recording.in_progress"):null,r=this.seek?Of(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return K`
|
||
|
${this.cameraTitle?K` <div class="title">
|
||
|
<span title="${this.cameraTitle}">${this.cameraTitle}</span>
|
||
|
</div>`:""}
|
||
|
<div class="details">
|
||
|
${t?K` <div>
|
||
|
<ha-icon
|
||
|
title=${Pm("recording.start")}
|
||
|
.icon=${"mdi:calendar-clock-outline"}
|
||
|
></ha-icon>
|
||
|
<span title="${t}">${t}</span>
|
||
|
</div>
|
||
|
${i||a?K` <div>
|
||
|
<ha-icon
|
||
|
title=${Pm("recording.duration")}
|
||
|
.icon=${"mdi:clock-outline"}
|
||
|
></ha-icon>
|
||
|
${i?K`<span title="${i}">${i}</span>`:""}
|
||
|
${a?K`<span title="${a}">${a}</span>`:""}
|
||
|
</div>`:""}`:""}
|
||
|
${r?K` <div>
|
||
|
<ha-icon
|
||
|
title=${Pm("event.seek")}
|
||
|
.icon=${"mdi:clock-fast"}
|
||
|
></ha-icon>
|
||
|
<span title="${r}">${r}</span>
|
||
|
</div>`:K``}
|
||
|
${null!==o?K`<div>
|
||
|
<ha-icon
|
||
|
title=${Pm("recording.events")}
|
||
|
.icon=${"mdi:shield-alert"}
|
||
|
></ha-icon>
|
||
|
<span title="${o}">${o}</span>
|
||
|
</div>`:""}
|
||
|
</div>
|
||
|
`}static get styles(){return b(uy)}};e([be({attribute:!1})],ky.prototype,"media",void 0),e([be({attribute:!1})],ky.prototype,"seek",void 0),e([be({attribute:!1})],ky.prototype,"cameraTitle",void 0),ky=e([_e("frigate-card-thumbnail-details-recording")],ky);let Ey=class extends ge{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()},i=this.show_timeline_control&&this.view&&(!_y.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),a=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&a?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&a?.canDownload,s=this.cameraManager.getCameraMetadata(this.hass,this.media.getCameraID())?.title;return K`
|
||
|
${_y.isEvent(this.media)?K`<frigate-card-thumbnail-feature-event
|
||
|
aria-label="${t??""}"
|
||
|
title=${t}
|
||
|
.hass=${this.hass}
|
||
|
.thumbnail=${e??void 0}
|
||
|
></frigate-card-thumbnail-feature-event>`:_y.isRecording(this.media)?K`<frigate-card-thumbnail-feature-recording
|
||
|
aria-label="${t??""}"
|
||
|
title="${t??""}"
|
||
|
.cameraTitle=${this.details?void 0:s}
|
||
|
.date=${this.media.getStartTime()??void 0}
|
||
|
></frigate-card-thumbnail-feature-recording>`:K``}
|
||
|
${r?K` <ha-icon
|
||
|
class="${Ee(n)}"
|
||
|
icon=${this.media.isFavorite()?"mdi:star":"mdi:star-outline"}
|
||
|
title=${Pm("thumbnail.retain_indefinitely")}
|
||
|
@click=${async e=>{if(vm(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.hass,this.media,!this.media?.isFavorite()))}catch(e){return void Nf(e)}this.requestUpdate()}}}
|
||
|
/></ha-icon>`:""}
|
||
|
${this.details&&_y.isEvent(this.media)?K`<frigate-card-thumbnail-details-event
|
||
|
.media=${this.media??void 0}
|
||
|
.cameraTitle=${s}
|
||
|
.seek=${this.seek}
|
||
|
></frigate-card-thumbnail-details-event>`:this.details&&_y.isRecording(this.media)?K`<frigate-card-thumbnail-details-recording
|
||
|
.media=${this.media??void 0}
|
||
|
.cameraTitle=${s}
|
||
|
.seek=${this.seek}
|
||
|
></frigate-card-thumbnail-details-recording>`:K``}
|
||
|
${i?K`<ha-icon
|
||
|
class="timeline"
|
||
|
icon="mdi:target"
|
||
|
title=${Pm("thumbnail.timeline")}
|
||
|
@click=${e=>{vm(e),this.view&&this.media&&this.view.evolve({view:"timeline",queryResults:this.view.queryResults?.clone().selectResultIfFound((e=>e===this.media))}).removeContext("timeline").dispatchChangeEvent(this)}}
|
||
|
></ha-icon>`:""}
|
||
|
${o?K` <ha-icon
|
||
|
class="download"
|
||
|
icon=${"mdi:download"}
|
||
|
title=${Pm("thumbnail.download")}
|
||
|
@click=${async e=>{if(vm(e),this.hass&&this.cameraManager&&this.media)try{await by(this.hass,this.cameraManager,this.media)}catch(e){Mv(this,e)}}}
|
||
|
></ha-icon>`:""}
|
||
|
`}static get styles(){return b(":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, frigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([be({attribute:!1})],Ey.prototype,"hass",void 0),e([be({attribute:!1})],Ey.prototype,"cameraManager",void 0),e([be({attribute:!0})],Ey.prototype,"media",void 0),e([be({attribute:!0,type:Boolean})],Ey.prototype,"details",void 0),e([be({attribute:!0,type:Boolean})],Ey.prototype,"show_favorite_control",void 0),e([be({attribute:!0,type:Boolean})],Ey.prototype,"show_timeline_control",void 0),e([be({attribute:!0,type:Boolean})],Ey.prototype,"show_download_control",void 0),e([be({attribute:!1})],Ey.prototype,"seek",void 0),e([be({attribute:!1})],Ey.prototype,"view",void 0),Ey=e([_e("frigate-card-thumbnail")],Ey);let My=class extends ge{constructor(){super(...arguments),this.direction="horizontal",this.selected=0,this._refSlot=Le(),this._scrolling=!1,this._reInitOnSettle=!1,this._carouselReInitInPlace=yr(this._carouselReInitInPlaceInternal.bind(this),500,{trailing:!0})}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._destroyCarousel(),super.disconnectedCallback()}willUpdate(e){["direction","carouselOptions","carouselPlugins"].some((t=>e.has(t)))&&this._destroyCarousel()}getCarouselSelected(){const e=this._carousel?.selectedScrollSnap(),t=void 0!==e?this._carousel?.slideNodes()[e]??null:null;return void 0!==e&&t?{index:e,element:t}:null}carousel(){return this._carousel??null}_carouselReInitInPlaceInternal(){(e=>{window.requestAnimationFrame((()=>{this._carousel?.reInit({...e})}))})({startIndex:this.selected})}carouselReInitWhenSafe(){this._scrolling?this._reInitOnSettle=!0:this._carouselReInitInPlace()}getCarouselPlugins(){return this._carousel?.plugins()??null}updated(e){super.updated(e),this._carousel||this._initCarousel(),e.has("selected")&&this._carousel?.scrollTo(this.selected,"none"===this.transitionEffect)}_destroyCarousel(){this._carousel&&this._carousel.destroy(),this._carousel=void 0}_initCarousel(){const e=this.renderRoot.querySelector(".embla__viewport"),t={root:e,slides:this._refSlot.value?.assignedElements({flatten:!0})};if(e&&t.slides){this._carousel=W_(t,{axis:"horizontal"==this.direction?"x":"y",speed:30,startIndex:this.selected,...this.carouselOptions},this.carouselPlugins);const e=()=>{const e=this.getCarouselSelected();e&&If(this,"carousel:select",e),this.requestUpdate()};this._carousel.on("init",e),this._carousel.on("select",e),this._carousel.on("scroll",(()=>{this._scrolling=!0})),this._carousel.on("settle",(()=>{this._scrolling=!1,this._reInitOnSettle&&(this._reInitOnSettle=!1,this._carouselReInitInPlace())})),this._carousel.on("settle",(()=>{const e=this.getCarouselSelected();e&&If(this,"carousel:settle",e)}))}}_slotChanged(){this._destroyCarousel(),this.requestUpdate()}render(){const e=this._refSlot.value?.assignedElements({flatten:!0})||[],t=this.carouselOptions?.loop||this.selected>0,n=this.carouselOptions?.loop||this.selected+1<e.length;return K` <div class="embla">
|
||
|
${t?K`<slot name="previous"></slot>`:""}
|
||
|
<div class="embla__viewport">
|
||
|
<div class="embla__container">
|
||
|
<slot ${Fe(this._refSlot)} @slotchange=${this._slotChanged.bind(this)}></slot>
|
||
|
</div>
|
||
|
</div>
|
||
|
${n?K`<slot name="next"></slot>`:""}
|
||
|
</div>`}static get styles(){return b(":host {\n display: block;\n height: 100%;\n width: 100%;\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([be({attribute:!0,reflect:!0})],My.prototype,"direction",void 0),e([be({attribute:!1})],My.prototype,"carouselOptions",void 0),e([be({attribute:!1})],My.prototype,"carouselPlugins",void 0),e([be({attribute:!1})],My.prototype,"selected",void 0),e([be({attribute:!0})],My.prototype,"transitionEffect",void 0),My=e([_e("frigate-card-carousel")],My);let Sy=class extends ge{constructor(){super(),this._refCarousel=Le(),this.selected=0,this._carouselOptions={containScroll:"keepSnaps",dragFree:!0},this._carouselPlugins=[dy({forceWheelAxis:"y"})],this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this))}_resizeHandler(){this._refCarousel.value?.carouselReInitWhenSafe()}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this)}disconnectedCallback(){this._resizeObserver.disconnect(),super.disconnectedCallback()}_getSlides(){if(!this.view?.query||!this.view.queryResults?.hasResults())return[];const e=[];for(let t=0;t<this.view.queryResults.getResultsCount();++t){const n=this._renderThumbnail(t);n&&(e[t]=n)}return e}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")}e.has("selected")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",void 0===this.selected?"1.0":"0.4")}_renderThumbnail(e){const t=this.view?.queryResults?.getResult(e)??null;if(!t||!this.view)return;const n={embla__slide:!0,"slide-selected":this.selected===e},i=this.view?.context?.mediaViewer?.seek;return K` <frigate-card-thumbnail
|
||
|
class="${Ee(n)}"
|
||
|
.cameraManager=${this.cameraManager}
|
||
|
.hass=${this.hass}
|
||
|
.media=${t}
|
||
|
.view=${this.view}
|
||
|
.seek=${i&&t.includesTime(i)?i: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=${t=>{this.view&&this.view.queryResults&&If(this,"thumbnail-carousel:tap",{queryResults:this.view.queryResults.clone().selectResult(e)}),vm(t)}}
|
||
|
>
|
||
|
</frigate-card-thumbnail>`}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":void 0}render(){const e=this._getSlides();if(e.length&&this.config&&"none"!==this.config.mode)return K`<frigate-card-carousel
|
||
|
${Fe(this._refCarousel)}
|
||
|
direction=${c_(this._getDirection())}
|
||
|
.selected=${this.selected??0}
|
||
|
.carouselOptions=${this._carouselOptions}
|
||
|
.carouselPlugins=${this._carouselPlugins}
|
||
|
>
|
||
|
${e}
|
||
|
</frigate-card-carousel>`}static get styles(){return b(":host {\n --frigate-card-thumbnail-size-max: 175px;\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([be({attribute:!1})],Sy.prototype,"hass",void 0),e([be({attribute:!1})],Sy.prototype,"view",void 0),e([be({attribute:!1})],Sy.prototype,"cameraManager",void 0),e([be({attribute:!1})],Sy.prototype,"config",void 0),e([be({attribute:!1})],Sy.prototype,"selected",void 0),Sy=e([_e("frigate-card-thumbnail-carousel")],Sy);class Ty{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return Gi(this)}getQueries(){return this._queries}setQueries(e){this._queries=e}}class Ay extends Ty{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0}clone(){return Gi(this)}}class zy extends Ty{}class jy{static areEventQueries(e){return e instanceof Ay}static areRecordingQueries(e){return e instanceof zy}}class Oy{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}static isMajorMediaChange(e,t){return!e||!t||e.view!==t.view||e.camera!==t.camera||"live"===t.view&&e.context?.live?.overrides?.get(e.camera)!==t.context?.live?.overrides?.get(t.camera)||"live"!==t.view&&e.queryResults!==t.queryResults}static adoptFromViewIfAppropriate(e,t){if(!t)return;let n=null;if(jy.areEventQueries(t.query)){const e=t.query.getQueries();e?.every((e=>e.hasClip))?n="clips":e?.every((e=>e.hasSnapshot))&&(n="snapshots")}else jy.areRecordingQueries(t.query)&&(n="recordings");const i=!e.query||!e.queryResults,a=t.isViewerView()&&e.isGalleryView()&&e.view===n,r=t?.is("media")&&e.is("media");if(i&&(a?(t.query&&(e.query=t.query),t.queryResults&&(e.queryResults=t.queryResults)):r&&n&&(e.view="clips"===n?"clip":"snapshots"===n?"snapshot":"recording")),t.is("live")&&e.is("live")&&t.context?.live?.overrides&&!e.context?.live?.overrides){const n=e.context?.live??{};n.overrides=t.context.live.overrides,e.mergeInContext({live:n})}}clone(){return new Oy({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context})}evolve(e){return new Oy({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})}mergeInContext(e){return this.context={...this.context,...e},this}removeContext(e){return this.context&&delete this.context[e],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["clip","snapshot","media","recording"].includes(this.view)}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}dispatchChangeEvent(e){If(e,"view:change",this)}}const Iy=(e,t)=>{If(e,"view:change-context",t)},Ry=document.createElement("template");Ry.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
|
||
|
<side-drawer
|
||
|
${Fe(this._refDrawer)}
|
||
|
location="${this.location}"
|
||
|
?open=${this.open}
|
||
|
@mouseleave=${()=>{this.open&&(this.open=!1)}}
|
||
|
>
|
||
|
${this.control?K`
|
||
|
<div
|
||
|
class="control-surround"
|
||
|
@click=${e=>{vm(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 ${Fe(this._refSlot)} @slotchange=${()=>this._slotChanged()}></slot>
|
||
|
</side-drawer>
|
||
|
`}static get styles(){return b("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]), :host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])), :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, ha-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([be({attribute:!0,reflect:!0})],Py.prototype,"location",void 0),e([be({attribute:!0,reflect:!0,type:Boolean})],Py.prototype,"control",void 0),e([be({type:Boolean,reflect:!0,attribute:!0})],Py.prototype,"open",void 0),e([be({attribute:!1})],Py.prototype,"icons",void 0),e([be({type:Boolean,reflect:!0,attribute:!0})],Py.prototype,"empty",void 0),Py=e([_e("frigate-card-drawer")],Py);let Ly=class extends ge{constructor(){super(...arguments),this._refDrawerLeft=Le(),this._refDrawerRight=Le(),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 K` <slot name="above"></slot>
|
||
|
<slot></slot>
|
||
|
<frigate-card-drawer
|
||
|
${Fe(this._refDrawerLeft)}
|
||
|
location="left"
|
||
|
.icons=${this.drawerIcons?.left}
|
||
|
>
|
||
|
<slot name="left"></slot>
|
||
|
</frigate-card-drawer>
|
||
|
<frigate-card-drawer
|
||
|
${Fe(this._refDrawerRight)}
|
||
|
location="right"
|
||
|
.icons=${this.drawerIcons?.right}
|
||
|
>
|
||
|
<slot name="right"></slot>
|
||
|
</frigate-card-drawer>
|
||
|
<slot name="below"></slot>`}static get styles(){return b(":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([be({attribute:!1})],Ly.prototype,"drawerIcons",void 0),Ly=e([_e("frigate-card-surround-basic")],Ly);var Ny=4;class Uy{constructor(e,t){this._results=null,this._resultsTimestamp=null,this._selectedIndex=null,e&&this.setResults(e),void 0!==t&&this.selectResult(t)}clone(){return Bi(this,Ny)}isSupersetOf(e){if(!this._results||!e._results)return!1;const t=new Set(this._results.map((e=>e.getID()))),n=new Set(e._results.map((e=>e.getID())));return!(!t||!n||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getResults(){return this._results}getResultsCount(){return this._results?.length??0}hasResults(){return!!this._results}setResults(e){this._results=e,this._resultsTimestamp=new Date}getResult(e){return this._results&&void 0!==e?this._results[e]:null}getSelectedResult(){return null===this._selectedIndex?null:this.getResult(this._selectedIndex)}getSelectedIndex(){return this._selectedIndex}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){return this._selectedIndex=null,this}getResultsTimestamp(){return this._resultsTimestamp}selectResult(e){return(null===e||this._results&&e>=0&&e<this._results.length)&&(this._selectedIndex=e),this}selectResultIfFound(e){for(const[t,n]of this._results?.entries()??[])if(e(n)){this._selectedIndex=t;break}return this}selectBestResult(e){if(this._results){const t=e(this._results);null!==t&&(this._selectedIndex=t)}return this}}const Fy=async(e,t,n,i,a,r)=>{const o=pv(n,a.camera);if(!o)return;const s=Hy(n,i,o,{mediaType:r?.mediaType});s&&(await Vy(e,t,n,a,s,{targetView:r?.targetView,select:r?.select}))?.dispatchChangeEvent(e)},Hy=(e,t,n,i)=>{const a=t.performance?.features.media_chunk_size??50,r=e.generateDefaultEventQueries(n,{limit:a,..."clips"===i?.mediaType&&{hasClip:!0},..."snapshots"===i?.mediaType&&{hasSnapshot:!0}});return r?new Ay(r):null},Zy=async(e,t,n,i,a,r)=>{const o=pv(n,a.camera);if(!o)return;const s=qy(n,i,o);s&&(await Vy(e,t,n,a,s,{targetView:r?.targetView,select:r?.select}))?.dispatchChangeEvent(e)},qy=(e,t,n,i)=>{const a=t.performance?.features.media_chunk_size??50,r=e.generateDefaultRecordingQueries(n,{limit:a,...i?.start&&{start:i.start},...i?.end&&{end:i.end}});return r?new zy(r):null},Vy=async(e,t,n,i,a,r)=>{let o;const s=a.getQueries();if(!s)return null;try{o=await n.executeMediaQueries(t,s)}catch(t){return Nf(t),Mv(e,t),null}if(!o)return null;const c=new Uy(o,"latest"===r?.select&&o.length?o.length-1:void 0);let l={};return"time"===r?.select&&r?.targetTime&&(c.selectBestResult((e=>Wy(e,r.targetTime))),l={mediaViewer:{seek:r.targetTime}}),i?.evolve({query:a,queryResults:c,view:r?.targetView,camera:r?.targetCameraID}).mergeInContext(l)??null},Wy=(e,t)=>{let n;for(const[i,a]of e.entries()){const e=a.getStartTime(),r=a.getUsableEndTime();if(a.includesTime(t)&&e&&r){const t=r.getTime()-e.getTime();(!n||t>n.duration)&&(n={index:i,duration:t})}}return n?n.index:null};let By=class extends ge{async _fetchMedia(){this.cameraManager&&this.cardWideConfig&&this.fetchMedia&&this.hass&&this.view&&!this.view.query&&this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode&&(this.view.context?.thumbnails?.fetch??1)&&await Fy(this,this.hass,this.cameraManager,this.cardWideConfig,this.view,{targetView:this.view.view,mediaType:this.fetchMedia,select:"latest"})}_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-6aa9e747.js"),e.has("view")&&Oy.isMajorMediaChange(e.get("view"),this.view)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0),["view","fetch","browseMediaParams"].some((t=>e.has(t)))&&this._fetchMedia()}_getCameraIDsForTimeline(){return this.view?this.view?.is("live")?pv(this.cameraManager,this.view.c
|
||
|
@frigate-card:thumbnails:open=${t=>e(t,"open")}
|
||
|
@frigate-card:thumbnails:close=${t=>e(t,"close")}
|
||
|
>
|
||
|
${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?K` <frigate-card-thumbnail-carousel
|
||
|
slot=${this.thumbnailConfig.mode}
|
||
|
.hass=${this.hass}
|
||
|
.config=${this.thumbnailConfig}
|
||
|
.cameraManager=${this.cameraManager}
|
||
|
.view=${this.view}
|
||
|
.selected=${this.view.queryResults?.getSelectedIndex()??void 0}
|
||
|
@frigate-card:view:change=${t=>e(t,"close")}
|
||
|
@frigate-card:thumbnail-carousel:tap=${e=>{const t=e.detail.queryResults.getSelectedResult();t&&this.view?.evolve({view:"media",queryResults:e.detail.queryResults,...t.getCameraID()&&{camera:t.getCameraID()}}).removeContext("timeline").dispatchChangeEvent(e.composedPath()[0])}}
|
||
|
>
|
||
|
</frigate-card-thumbnail-carousel>`:""}
|
||
|
${this.timelineConfig&&"none"!==this.timelineConfig.mode?K` <frigate-card-timeline-core
|
||
|
slot=${this.timelineConfig.mode}
|
||
|
.hass=${this.hass}
|
||
|
.view=${this.view}
|
||
|
.itemClickAction=${this.view.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 b(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};e([be({attribute:!1})],By.prototype,"hass",void 0),e([be({attribute:!1})],By.prototype,"view",void 0),e([be({attribute:!1,hasChanged:Lf})],By.prototype,"thumbnailConfig",void 0),e([be({attribute:!1,hasChanged:Lf})],By.prototype,"timelineConfig",void 0),e([be({attribute:!1,hasChanged:Lf})],By.prototype,"fetchMedia",void 0),e([be({attribute:!1})],By.prototype,"cameraManager",void 0),e([be({attribute:!1})],By.prototype,"cardWideConfig",void 0),By=e([_e("frigate-card-surround")],By);let Yy=class extends ge{willUpdate(e){(e.has("view")||e.has("config"))&&((this.view?.is("live")||this._shouldLivePreload())&&import("./live-e0c9196c.js"),this.view?.isGalleryView()?import("./gallery-6281c347.js"):this.view?.isViewerView()?import("./viewer-b95bc789.js"):this.view?.is("image")?import("./image-0b99ab11.js"):this.view?.is("timeline")&&import("./timeline-6aa9e747.js")),e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){return!!this.config?.live.preload}render(){if(!this.hass||!this.config||!this.nonOverriddenConfig)return K``;const e={hidden:this._shouldLivePreload()&&!this.view?.is("live")},t={hidden:!!this.hide},n=this.view?.is("live")?this.config.live.controls.thumbnails:this.view?.isViewerView()?this.config.media_viewer.controls.thumbnails:this.view?.is("timeline")?this.config.timeline.controls.thumbnails:void 0,i=this.view?.is("live")?this.config.live.controls.timeline:this.view?.isViewerView()?this.config.media_viewer.controls.timeline:void 0,a=this.view?this.cameraManager?.getStore().getCameraConfig(this.view.camera)??null:null;return K` <frigate-card-surround
|
||
|
class="${Ee(t)}"
|
||
|
.hass=${this.hass}
|
||
|
.view=${this.view}
|
||
|
.fetchMedia=${this.view?.is("live")?this.config.live.controls.thumbnails.media:void 0}
|
||
|
.thumbnailConfig=${this.hide?void 0:n}
|
||
|
.timelineConfig=${this.hide?void 0:i}
|
||
|
.cameraManager=${this.cameraManager}
|
||
|
.cardWideConfig=${this.cardWideConfig}
|
||
|
>
|
||
|
${!this.hide&&this.view?.is("image")&&a?K` <frigate-card-image
|
||
|
.imageConfig=${this.config.image}
|
||
|
.view=${this.view}
|
||
|
.hass=${this.hass}
|
||
|
.cameraConfig=${a}
|
||
|
.supportZoom=${!0}
|
||
|
>
|
||
|
</frigate-card-image>`:""}
|
||
|
${!this.hide&&this.view?.isGalleryView()?K` <frigate-card-gallery
|
||
|
.hass=${this.hass}
|
||
|
.view=${this.view}
|
||
|
.galleryConfig=${this.config.media_gallery}
|
||
|
.cameraManager=${this.cameraManager}
|
||
|
.cardWideConfig=${this.cardWideConfig}
|
||
|
>
|
||
|
</frigate-card-gallery>`:""}
|
||
|
${!this.hide&&this.view?.isViewerView()?K`
|
||
|
<frigate-card-viewer
|
||
|
.hass=${this.hass}
|
||
|
.view=${this.view}
|
||
|
.viewerConfig=${this.config.media_viewer}
|
||
|
.resolvedMediaCache=${this.resolvedMediaCache}
|
||
|
.cameraManager=${this.cameraManager}
|
||
|
.cardWideConfig=${this.cardWideConfig}
|
||
|
>
|
||
|
</frigate-card-viewer>
|
||
|
`:""}
|
||
|
${!this.hide&&this.view?.is("timeline")?K` <frigate-card-timeline
|
||
|
.hass=${this.hass}
|
||
|
.view=${this.view}
|
||
|
.timelineConfig=${this.config.timeline}
|
||
|
.cameraManager=${this.cameraManager}
|
||
|
.cardWideConfig=${this.cardWideConfig}
|
||
|
>
|
||
|
</frigate-card-timeline>`:""}
|
||
|
${this._shouldLivePreload()||!this.hide&&this.view?.is("live")?K`
|
||
|
<frigate-card-live
|
||
|
.hass=${this.hass}
|
||
|
.view=${this.view}
|
||
|
.liveConfig=${this.nonOverriddenConfig.live}
|
||
|
.conditionControllerEpoch=${this.conditionControllerEpoch}
|
||
|
.liveOverrides=${r="live",o=this.config.overrides,o?.filter((e=>r in e.overrides)).map((e=>({conditions:e.conditions,overrides:e.overrides[r]})))??[]}
|
||
|
.cameraManager=${this.cameraManager}
|
||
|
.cardWideConfig=${this.cardWideConfig}
|
||
|
.microphoneStream=${this.microphoneStream}
|
||
|
class="${Ee(e)}"
|
||
|
>
|
||
|
</frigate-card-live>
|
||
|
`:""}
|
||
|
</frigate-card-surround>`;var r,o}static get styles(){return b(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([be({attribute:!1})],Yy.prototype,"hass",void 0),e([be({attribute:!1})],Yy.prototype,"view",void 0),e([be({attribute:!1})],Yy.prototype,"cameraManager",void 0),e([be({attribute:!1})],Yy.prototype,"config",void 0),e([be({attribute:!1})],Yy.prototype,"nonOverriddenConfig",void 0),e([be({attribute:!1})],Yy.prototype,"cardWideConfig",void 0),e([be({attribute:!1})],Yy.prototype,"resolvedMediaCache",void 0),e([be({attribute:!1})],Yy.prototype,"conditionControllerEpoch",void 0),e([be({attribute:!1})],Yy.prototype,"hide",void 0),e([be({attribute:!1})],Yy.prototype,"microphoneStream",void 0),Yy=e([_e("frigate-card-views")],Yy);const Qy={[Il]:"none",[sl]:"none",[bd]:"none",[Zl]:!1,[gl]:!1,[_d]:!1,[Sl]:"never",[Gc]:"never",[Kc]:"never",[Xc]:"never",[Jl]:"all",[Kl]:!1,[el]:!1,[td]:"none",[il]:"none",[nd]:!1,[rl]:"chevrons",[bl]:"none",[Wl]:"none",[Td]:"outside",[`${Rd}.enabled`]:!1,[`${Hd}.enabled`]:!1,[`${Hd}.enabled`]:!1,[`${Ud}.enabled`]:!1,[Vc]:!1,[Wc]:!1,[Bc]:!1,[qc]:!1,[Pl]:!1,[Ll]:!1,[Nl]:!1,[Dl]:!1,[ll]:!1,[dl]:!1,[ul]:!1,[cl]:!1,[Cd]:!1,[$d]:!1,[kd]:!1,[xd]:!1,[Gd]:!1,[Kd]:10,[eu]:!1,[Jd]:!1,[nl]:!1,[Mc]:!1,[Sc]:10},Gy=(e,t)=>{const n=iu(om).safeParse(e);if(n.success){const e=n.data;Object.entries(Qy).forEach((([n,i])=>((e,t,n,i)=>{void 0===Av(e,n)&&Tv(t,n,i)})(e,t,n,i)))}return t},Ky={box_shadow:"none",border_radius:"0px"};const Xy=Ws.object({model:Ws.string().nullable(),config_entries:Ws.string().array(),manufacturer:Ws.string().nullable()}).array();class Jy{constructor(){this._cache=new Map}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)}set(e){const t=e=>this._cache.set(e.entity_id,e);Array.isArray(e)?e.forEach(t):t(e)}}const eb=Ws.object({config_entry_id:Ws.string().nullable(),device_id:Ws.string().nullable(),disabled_by:Ws.string().nullable(),entity_id:Ws.string(),hidden_by:Ws.string().nullable(),platform:Ws.string(),translation_key:Ws.string().nullable(),unique_id:Ws.string().or(Ws.number()).optional()}),tb=eb.array();class nb{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;const i=await cp(e,eb,{type:"config/entity_registry/get",entity_id:t});return this._cache.set(i),i}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=>{let i=null;try{i=await this.getEntity(e,t)}catch{return}i&&n.set(t,i)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;const t=await cp(e,tb,{type:"config/entity_registry/list"});this._cache.set(t),this._fetchedEntityList=!0}}class ib 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
|
||
|
<frigate-card-menu
|
||
|
${Fe(this._refMenu)}
|
||
|
.hass=${this._hass}
|
||
|
.menuConfig=${this._getConfig().menu}
|
||
|
.buttons=${this._menuButtonController.calculateButtons(this._hass,this._getConfig(),this._cameraManager,this._view,this._expand,{currentMediaLoadedInfo:this._mediaLoadedInfoController.get(),mediaPlayers:this._mediaPlayers,cameraURL:this._getCameraURLFromContext(),microphoneController:this._microphoneController})}
|
||
|
.entityRegistryManager=${this._entityRegistryManager}
|
||
|
></frigate-card-menu>
|
||
|
`}_setMessageAndUpdate(e,t){const n=this._message?cm[this._message.type]??0:0,i=cm[e.type]??0;(!this._message||i>=n)&&(this._message=e,this._mediaUnloadedHandler(),t||(this.requestUpdate(),this._resetMainScroll()))}_resetMainScroll(){this._refMain.value?.scroll({top:0})}_messageHandler(e){return this._setMessageAndUpdate(e.detail)}_mediaLoadedHandler(e){const t=e.detail;_b(t)&&(hv(this._cardWideConfig,"Frigate Card media load: ",t),this._mediaLoadedInfoController.set(t),this._setPropertiesForExpandedMode(),this._conditionController?.setState({media_loaded:this._mediaLoadedInfoController.has()}),this.requestUpdate())}_setPropertiesForExpandedMode(){const e=this._mediaLoadedInfoController.getLastKnown();this.style.setProperty("--frigate-card-expand-aspect-ratio",this._view?.isAnyMediaView()&&e?`${e.width} / ${e.height}`:"unset"),this.style.setProperty("--frigate-card-expand-width",this._view?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),this.style.setProperty("--frigate-card-expand-height",this._view?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}_mediaUnloadedHandler(){this._mediaLoadedInfoController.clear(),this._conditionController?.setState({media_loaded:!1})}firstUpdated(){this._locationChangeHandler()}connectedCallback(){super.connectedCallback(),$r.isEnabled&&$r.on("change",this._boundFullscreenHandler),this.addEventListener("mousemove",this._boundMouseHandler),this.addEventListener("ll-custom",this._boundCardActionEventHandler),this._panel=(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this),window.addEventListener("location-changed",this._locationChangeHandler),window.addEventListener("popstate",this._locationChangeHandler),this._locationChangeHandler()}disconnectedCallback(){this._mediaUnloadedHandler(),$r.isEnabled&&$r.off("change",this._boundFullscreenHandler),this.removeEventListener("mousemove",this._boundMouseHandler),this.removeEventListener("ll-custom",this._boundCardActionEventHandler),window.removeEventListener("location-changed",this._locationChangeHandler),window.removeEventListener("popstate",this._locationChangeHandler),super.disconnectedCallback()}_isAspectRatioEnforced(){const e=this._getConfig().dimensions.aspect_ratio_mode;return!($r.isEnabled&&$r.isFullscreen||this._expand||"unconstrained"==e||"dynamic"==e&&(this._view?.isAnyMediaView()||this._view?.is("timeline")))}_getAspectRatioStyle(){if(!this._isAspectRatioEnforced())return"auto";const e=this._getConfig().dimensions.aspect_ratio_mode,t=this._mediaLoadedInfoController.getLastKnown();if(t&&"dynamic"===e)return`${t.width} / ${t.height}`;const n=this._getConfig().dimensions.aspect_ratio;return n?`${n[0]} / ${n[1]}`:"16 / 9"}_getMergedActions(){if(this._message||this._view?.is("timeline"))return{};let e;return this._view?.is("live")?e=this._getConfig().live.actions:this._view?.isGalleryView()?e=this._getConfig().media_gallery?.actions:this._view?.isViewerView()?e=this._getConfig().media_viewer.actions:this._view?.is("image")&&(e=this._getConfig().image?.actions),{...this._getConfig().view.actions,...e}}_isInFullscreen(){return $r.isEnabled&&$r.isFullscreen}_setExpand(e){e&&this._isInFullscreen()&&$r.exit(),this._expand=e,this._conditionController?.setState({expand:this._expand})}_fullscreenHandler(){this._isInFullscreen()&&(this._expand=!1),this._conditionController?.setState({fullscreen:this._isInFullscreen(),expand:this._expand}),this.requestUpdate()}_renderInDialogIfNecessary(e){return this._expand?K` <web-dialog
|
||
|
open
|
||
|
center
|
||
|
@close=${()=>{this._setExpand(!1)}}
|
||
|
>
|
||
|
${e}
|
||
|
</web-dialog>`:e}render(){if(!this._hass)return;const e={"aspect-ratio":this._getAspectRatioStyle()},t={triggered:!!this._isTriggered()&&this._getConfig().view.scan.show_trigger_status},n={main:!0,"curve-top":"outside"!==this._getConfig().menu.style||"top"!==this._getConfig().menu.position,"curve-bottom":"outside"!==this._getConfig().menu.style||"top"===this._getConfig().menu.position},i=this._getMergedActions(),a="outside"===this._getConfig().menu.style&&"top"===this._getConfig().menu.position;return this._renderInDialogIfNecessary(K` <ha-card
|
||
|
id="ha-card"
|
||
|
.actionHandler=${wm({hasHold:gm(i.hold_action),hasDoubleClick:gm(i.double_tap_action)})}
|
||
|
class="${Ee(t)}"
|
||
|
style="${He(e)}"
|
||
|
@action=${e=>this._actionHandler(e,i)}
|
||
|
@frigate-card:message=${this._messageHandler.bind(this)}
|
||
|
@frigate-card:view:change=${this._changeViewHandler.bind(this)}
|
||
|
@frigate-card:view:change-context=${this._addViewContextHandler.bind(this)}
|
||
|
@frigate-card:media:loaded=${this._mediaLoadedHandler.bind(this)}
|
||
|
@frigate-card:media:unloaded=${this._mediaUnloadedHandler.bind(this)}
|
||
|
@frigate-card:media:volumechange=${()=>this.requestUpdate()}
|
||
|
@frigate-card:media:play=${()=>this.requestUpdate()}
|
||
|
@frigate-card:media:pause=${()=>this.requestUpdate()}
|
||
|
@frigate-card:render=${()=>this.requestUpdate()}
|
||
|
>
|
||
|
${a?this._renderMenu():""}
|
||
|
<div ${Fe(this._refMain)} class="${Ee(n)}">
|
||
|
${this._cameraManager?.isInitialized()||this._message?K`<frigate-card-views
|
||
|
${Fe(this._refViews)}
|
||
|
.hass=${this._hass}
|
||
|
.view=${this._view}
|
||
|
.cardWideConfig=${this._cardWideConfig}
|
||
|
.cameraManager=${this._cameraManager}
|
||
|
.resolvedMediaCache=${this._resolvedMediaCache}
|
||
|
.config=${this._getConfig()}
|
||
|
.nonOverriddenConfig=${this._config}
|
||
|
.conditionControllerEpoch=${this._conditionController?.getEpoch()}
|
||
|
.hide=${!!this._message}
|
||
|
.microphoneStream=${this._microphoneController?.getStream()}
|
||
|
></frigate-card-views>`:$v({cardWideConfig:this._cardWideConfig})}
|
||
|
${this._message?Cv(this._message):""}
|
||
|
</div>
|
||
|
${a?"":this._renderMenu()}
|
||
|
${this._getConfig().elements?K` <frigate-card-elements
|
||
|
${Fe(this._refElements)}
|
||
|
.hass=${this._hass}
|
||
|
.elements=${this._getConfig().elements}
|
||
|
.conditionControllerEpoch=${this._conditionController?.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:condition:evaluate=${e=>{e.evaluation=this._conditionController?.evaluateCondition(e.condition)}}
|
||
|
>
|
||
|
</frigate-card-elements>`:""}
|
||
|
</ha-card>`)}static get styles(){return b(":host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n max-height: var(--frigate-card-max-height);\n min-height: var(--frigate-card-min-height);\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-max-height: none;\n --frigate-card-min-height: none;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n box-sizing: border-box;\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\n/* The 'hover' menu mode is styled applied outside of the menu itself */\nfrigate-card-menu[data-style*=hover] {\n z-index: 1;\n transition: opacity 0.5s ease;\n}\n\n.main + frigate-card-menu[data-style*=hover] {\n opacity: 0;\n}\n\nfrigate-card-menu[data-style=hover]:hover {\n opacity: 1;\n}\n\n.main:hover + frigate-card-menu[data-style=hover-card],\nfrigate-card-menu[data-style=hover-card]:hover {\n opacity: 1;\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\nha-card.triggered {\n animation: warning-pulse 5s infinite;\n}\n@keyframes warning-pulse {\n 0% {\n border: solid 2px rgba(0, 0, 0, 0);\n }\n 50% {\n border: solid 2px var(--warning-color);\n }\n 100% {\n border: solid 2px rgba(0, 0, 0, 0);\n }\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}")}getCardSize(){const e=this._mediaLoadedInfoController.getLastKnown();return e?e.height/50:6}};e([we()],kb.prototype,"_hass",void 0),e([we()],kb.prototype,"_config",void 0),e([we()],kb.prototype,"_cardWideConfig",void 0),e([we()],kb.prototype,"_overriddenConfig",void 0),e([we()],kb.prototype,"_view",void 0),e([be({attribute:"panel",type:Boolean,reflect:!0})],kb.prototype,"_panel",void 0),e([we()],kb.prototype,"_expand",void 0),kb=e([_e("frigate-card")],kb);export{nd as $,wp as A,su as B,Pc as C,jv as D,jc as E,pu as F,Ac as G,zc as H,Oc as I,Dc as J,Rc as K,Ic as L,Td as M,Sd as N,Md as O,Ad as P,ed as Q,Kl as R,rd as S,lu as T,Xl as U,Jl as V,El as W,Ml as X,Sl as Y,Tl as Z,td as _,Gy as a,cd as a$,Al as a0,zl as a1,jl as a2,Rl as a3,Dl as a4,Ll as a5,Nl as
|