diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 6020c9cb..430f05b1 100755 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -10,7 +10,12 @@ rules: class-methods-use-this: 0 no-nested-ternary: 0 camelcase: 0 + no-console: 0 + prefer-destructuring: 0 + quote-props: 0 globals: window: true Event: true customElements: true + document: true + navigator: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aeec7c0e..46af7c64 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,10 @@ name: Release -on: workflow_dispatch +on: + push: + branches: + - master + - dev jobs: release-bundle: diff --git a/.gitignore b/.gitignore index 061a7f3e..99f211df 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /node_modules/ -/dist/ .DS_Store diff --git a/dist/mini-graph-card-bundle.js b/dist/mini-graph-card-bundle.js new file mode 100644 index 00000000..d6276093 --- /dev/null +++ b/dist/mini-graph-card-bundle.js @@ -0,0 +1 @@ +(function(){"use strict";function a(){var b=Aa([""]);return a=function(){return b},b}function b(){var a=Aa(["\n
\n ","\n \n "," ","\n \n \n ","\n \n
\n "]);return b=function(){return a},a}function c(){var a=Aa(["\n
\n ","\n
\n "]);return c=function(){return a},a}function d(){var a=Aa(["\n
\n ","\n ","\n
\n "]);return d=function(){return a},a}function e(){var a=Aa(["\n
\n ","\n ","\n
\n "]);return e=function(){return a},a}function f(){var a=Aa(["\n \n \n \n ","\n \n ","\n ","\n ","\n ","\n ","\n \n ","\n "]);return f=function(){return a},a}function g(){var a=Aa(["",""]);return g=function(){return a},a}function h(){var a=Aa(["\n \n ","\n "]);return h=function(){return a},a}function j(){var a=Aa(["\n \n "]);return j=function(){return a},a}function k(){var a=Aa(["\n "]);return k=function(){return a},a}function l(){var a=Aa(["\n "]);return l=function(){return a},a}function m(){var a=Aa(["",""]);return m=function(){return a},a}function n(){var a=Aa(["\n \n "]);return n=function(){return a},a}function o(){var a=Aa(["\n \n ","\n "]);return o=function(){return a},a}function p(){var a=Aa(["\n \n ","\n "]);return p=function(){return a},a}function q(){var a=Aa(["\n \n "]);return q=function(){return a},a}function r(){var a=Aa(["\n \n ","\n \n "]);return r=function(){return a},a}function s(){var a=Aa(["\n "]);return s=function(){return a},a}function t(){var a=Aa(["\n \n \n \n \n \n \n \n \n \n \n \n "]);return t=function(){return a},a}function u(){var a=Aa(["\n \n \n \n "]);return u=function(){return a},a}function v(){var a=Aa(["\n
\n ","\n ","\n
\n "]);return v=function(){return a},a}function w(){var a=Aa(["\n
\n ","\n
\n "]);return w=function(){return a},a}function x(){var a=Aa([""]);return x=function(){return a},a}function y(){var a=Aa(["\n
\n ","\n ","\n
\n ","\n
\n
\n ","\n "]);return y=function(){return a},a}function z(){var a=Aa(["\n
\n ","\n
"]);return z=function(){return a},a}function A(){var a=Aa(["\n "," -\n ","\n "]);return A=function(){return a},a}function B(){var a=Aa(["\n ","\n "]);return B=function(){return a},a}function C(){var a=Aa(["\n
\n ","\n
\n "]);return C=function(){return a},a}function D(){var a=Aa(["\n \n ","\n \n ","\n \n \n ","\n \n ","\n \n "]);return D=function(){return a},a}function E(){var a=Aa(["\n
\n ","\n
","
\n ","\n
\n "]);return E=function(){return a},a}function F(){var a=Aa(["\n
\n ","\n
\n "]);return F=function(){return a},a}function G(){var a=Aa(["\n
\n \n
\n "]);return G=function(){return a},a}function H(){var a=Aa(["\n
\n \n
\n "]);return H=function(){return a},a}function I(){var a=Aa(["\n
\n "," ","\n
\n "]);return I=function(){return a},a}function J(){var a=Aa([""]);return J=function(){return a},a}function K(){var a=Aa(["\n
\n Entity not available: ","\n
\n "]);return K=function(){return a},a}function L(){var a=Aa(["\n \n
mini-graph-card
\n ","\n
\n "]);return L=function(){return a},a}function M(){var a=Aa(["\n \n "," "," "," ","\n \n "]);return M=function(){return a},a}function N(){var a=Aa([""]);return N=function(){return a},a}function O(){var a=Aa(["\n :host {\n display: block;\n font-family: var(--paper-font-body1_-_font-family);\n }\n\n .loading, .error {\n text-align: center;\n padding: 40px 20px;\n color: var(--primary-text-color);\n }\n\n .error {\n color: var(--error-color);\n }\n\n .error pre {\n text-align: left;\n background: var(--secondary-background-color);\n padding: 10px;\n border-radius: 4px;\n overflow: auto;\n font-size: 12px;\n }\n\n .card-config {\n padding: 20px;\n max-width: 800px;\n margin: 0 auto;\n }\n\n .header {\n text-align: center;\n margin-bottom: 30px;\n padding-bottom: 20px;\n border-bottom: 1px solid var(--divider-color);\n }\n\n .header h2 {\n color: var(--primary-text-color);\n margin: 0 0 10px 0;\n font-size: 1.5em;\n }\n\n .header p {\n color: var(--secondary-text-color);\n margin: 0;\n }\n\n .debug-info {\n margin-top: 10px;\n opacity: 0.7;\n }\n\n .section {\n margin-bottom: 20px;\n border: 1px solid var(--divider-color);\n border-radius: 8px;\n background: var(--card-background-color);\n overflow: hidden;\n }\n\n .section-header {\n display: flex;\n align-items: center;\n padding: 16px 20px;\n cursor: pointer;\n background: var(--primary-color);\n color: var(--text-primary-color);\n transition: background-color 0.2s ease;\n }\n\n .section-header:hover {\n opacity: 0.9;\n }\n\n .section-header.expanded {\n border-bottom: 1px solid var(--divider-color);\n }\n\n .section-info {\n flex: 1;\n }\n\n .section-title {\n font-weight: 500;\n font-size: 1.1em;\n margin-bottom: 2px;\n }\n\n .section-description {\n font-size: 0.9em;\n opacity: 0.8;\n }\n\n .section-toggle {\n font-size: 1.2em;\n font-weight: bold;\n }\n\n .section-content {\n padding: 20px;\n }\n\n .form-group {\n margin-bottom: 16px;\n min-width: 0; /* Prevents overflow in grid */\n }\n\n .form-group label {\n display: block;\n margin-bottom: 6px;\n font-weight: 500;\n color: var(--primary-text-color);\n font-size: 0.9em;\n }\n\n .form-row {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n margin-bottom: 16px;\n }\n\n input[type=\"text\"],\n input[type=\"number\"],\n input[type=\"color\"],\n select {\n width: 100%;\n padding: 10px 14px;\n border: 1px solid var(--divider-color);\n border-radius: 6px;\n background: var(--card-background-color);\n color: var(--primary-text-color);\n font-size: 14px;\n box-sizing: border-box;\n transition: border-color 0.2s ease;\n }\n\n input[type=\"text\"]:focus,\n input[type=\"number\"]:focus,\n select:focus {\n outline: none;\n border-color: var(--accent-color);\n box-shadow: 0 0 0 2px rgba(var(--accent-color-rgb, 3, 169, 244), 0.1);\n }\n\n input[type=\"color\"] {\n padding: 4px;\n height: 40px;\n cursor: pointer;\n }\n\n button {\n padding: 8px 16px;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n transition: all 0.2s ease;\n }\n\n .btn-add {\n background: var(--primary-color);\n color: var(--text-primary-color);\n }\n\n .btn-remove {\n background: var(--error-color);\n color: white;\n }\n\n .btn-add:hover,\n .btn-remove:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n }\n\n .checkbox-label {\n display: flex !important;\n align-items: center;\n gap: 8px;\n cursor: pointer;\n }\n\n .checkbox-label input[type=\"checkbox\"] {\n width: auto;\n }\n\n .show-options,\n .thresholds-section,\n .tap-action-section {\n margin-top: 24px;\n padding-top: 20px;\n border-top: 1px solid var(--divider-color);\n }\n\n .show-options h4,\n .thresholds-section h4,\n .tap-action-section h4 {\n margin: 0 0 16px 0;\n color: var(--primary-text-color);\n font-size: 1em;\n }\n\n .checkbox-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 12px;\n }\n\n .checkbox-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px;\n background: var(--secondary-background-color);\n border-radius: 4px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .checkbox-item:hover {\n background: var(--divider-color);\n }\n\n .checkbox-item input[type=\"checkbox\"] {\n margin: 0;\n width: auto;\n }\n\n .entity-row,\n .threshold-row {\n display: flex;\n align-items: center;\n gap: 16px;\n margin-bottom: 12px;\n padding: 14px;\n background: var(--secondary-background-color);\n border-radius: 6px;\n border: 1px solid var(--divider-color);\n }\n\n .entity-row > *:first-child,\n .threshold-row > *:first-child {\n flex: 1;\n }\n\n .thresholds-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 16px;\n }\n\n .entities-info {\n color: var(--secondary-text-color);\n font-size: 0.9em;\n margin-bottom: 20px;\n padding: 16px;\n background: var(--secondary-background-color);\n border-radius: 4px;\n border-left: 4px solid var(--primary-color);\n }\n\n .entity-config {\n margin-bottom: 16px;\n border: 1px solid var(--divider-color);\n border-radius: 6px;\n overflow: hidden;\n }\n\n .entity-config-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 12px 16px;\n background: var(--secondary-background-color);\n border-bottom: 1px solid var(--divider-color);\n }\n\n .entity-config-header button {\n flex-shrink: 0;\n min-width: 80px;\n }\n\n .entity-info {\n display: flex;\n align-items: center;\n flex: 1;\n min-width: 0;\n margin-right: 16px;\n }\n\n .entity-icon {\n color: var(--state-icon-color, var(--state-icon-unavailable-color, #bdbdbd));\n width: 24px;\n height: 24px;\n margin-right: 12px;\n flex-shrink: 0;\n }\n\n .entity-details {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n }\n\n .entity-friendly-name {\n font-weight: 500;\n color: var(--primary-text-color);\n font-size: 0.95em;\n word-wrap: break-word;\n line-height: 1.3;\n }\n\n .entity-id {\n color: var(--secondary-text-color);\n font-size: 0.8em;\n word-wrap: break-word;\n margin-top: 2px;\n line-height: 1.2;\n }\n\n .entities-section {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .entity-management-row {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border: 1px solid var(--divider-color);\n border-radius: 8px;\n background: var(--card-background-color);\n }\n\n .entity-top-section {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n align-items: center;\n }\n\n .entity-picker-section {\n min-width: 0;\n }\n\n .entity-info-section {\n min-width: 0;\n }\n\n .entity-display {\n display: flex;\n align-items: center;\n min-width: 0;\n }\n\n .entity-display .entity-icon {\n margin-right: 12px;\n flex-shrink: 0;\n }\n\n .entity-display .entity-details {\n flex: 1;\n min-width: 0;\n }\n\n .entity-actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n flex-wrap: wrap;\n }\n\n .btn-configure {\n background: var(--primary-color);\n color: var(--text-primary-color);\n border: none;\n padding: 8px 16px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n min-width: 80px;\n }\n\n .btn-configure:hover {\n opacity: 0.9;\n }\n\n .btn-remove {\n background: var(--error-color);\n color: white;\n border: none;\n padding: 8px 12px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 16px;\n font-weight: bold;\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .btn-remove:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n }\n\n .entity-config-expanded {\n margin-top: 12px;\n padding: 16px;\n border: 1px solid var(--divider-color);\n border-radius: 8px;\n background: var(--secondary-background-color);\n }\n\n\n .entity-config-content {\n padding: 16px;\n }\n\n .entity-switches {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));\n gap: 8px;\n margin-top: 16px;\n }\n\n ha-entity-picker,\n ha-icon-picker {\n width: 100%;\n }\n\n @media (max-width: 768px) {\n .form-row {\n gap: 16px;\n }\n }\n\n @media (max-width: 600px) {\n .card-config {\n padding: 16px;\n }\n\n .form-row {\n grid-template-columns: 1fr;\n gap: 12px;\n }\n\n .checkbox-grid {\n grid-template-columns: 1fr;\n }\n\n .entity-switches {\n grid-template-columns: 1fr;\n }\n\n .entity-row,\n .threshold-row {\n flex-direction: column;\n align-items: stretch;\n }\n\n .entity-row > *,\n .threshold-row > * {\n flex: none;\n }\n }\n "]);return O=function(){return a},a}function P(){var a=Aa(["\n \n "]);return P=function(){return a},a}function Q(){var a=Aa(["\n
\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n ","\n
\n
\n "]);return Q=function(){return a},a}function R(){var a=Aa(["\n \n "]);return R=function(){return a},a}function S(){var a=Aa(["\n \n "]);return S=function(){return a},a}function T(){var a=Aa(["\n \n "]);return T=function(){return a},a}function U(){var a=Aa(["\n \n \n ","\n \n "]);return U=function(){return a},a}function V(){var a=Aa(["\n \n "]);return V=function(){return a},a}function W(){var a=Aa(["
","
"]);return W=function(){return a},a}function X(){var a=Aa(["\n
\n
\n
\n
","
\n
","
\n
\n
","
\n
\n ","\n
\n "]);return X=function(){return a},a}function Y(){var a=Aa(["\n
\n

","

\n

",": ","

\n
","
\n
\n "]);return Y=function(){return a},a}function Z(){var a=Aa(["\n
\n \n \n
\n "]);return Z=function(){return a},a}function $(){var a=Aa(["\n
\n \n \n
\n "]);return $=function(){return a},a}function _(){var a=Aa(["\n
\n \n \n
\n "]);return _=function(){return a},a}function aa(){var a=Aa(["\n
\n
\n \n
\n\n
\n \n
\n
\n\n
\n \n
\n\n
\n

","

\n
\n
\n \n \n
\n\n ","\n\n ","\n\n ","\n
\n
\n "]);return aa=function(){return a},a}function ba(){var a=Aa(["\n
\n \n \n \n
\n "]);return ba=function(){return a},a}function ca(){var a=Aa(["\n
\n \n \n
\n\n
\n
\n

","

\n \n
\n\n ","\n
\n "]);return ca=function(){return a},a}function da(){var a=Aa(["\n

","

\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n \n \n
\n "]);return da=function(){return a},a}function ea(){var a=Aa(["\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n \n
\n\n
\n \n
\n
\n "]);return ea=function(){return a},a}function fa(){var a=Aa(["\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n
\n\n
\n \n
\n
\n\n
\n
\n \n
\n
\n "]);return fa=function(){return a},a}function ga(){var a=Aa(["\n \n "]);return ga=function(){return a},a}function ha(){var a=Aa(["\n
\n
\n \n \n
\n\n
\n \n ","\n
\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n
\n \n \n
\n\n
\n \n \n
\n
\n\n
\n

","

\n
\n ","\n
\n
\n "]);return ha=function(){return a},a}function ia(){var a=Aa(["\n
\n ","\n
\n "]);return ia=function(){return a},a}function ja(){var a=Aa(["\n
\n \n
\n
","
\n
","
\n
\n
\n "]);return ja=function(){return a},a}function ka(){var a=Aa(["\n
\n
\n
\n ","\n
\n
\n ","\n
\n
\n
\n \n \n
\n
\n ","\n "]);return ka=function(){return a},a}function la(){var a=Aa(["\n
\n \n ","\n
\n "]);return la=function(){return a},a}function ma(){var a=Aa(["\n ","\n\n
\n ","\n \n
\n "]);return ma=function(){return a},a}function na(){var a=Aa(["\n
\n
\n

","

\n

","

\n
\n\n \n ","\n\n \n ","\n\n \n ","\n\n \n ","\n\n \n ","\n\n \n ","\n\n \n ","\n\n
\n "]);return na=function(){return a},a}function oa(){var a=Aa(["\n
\n

","

\n

","

\n
\n "]);return oa=function(){return a},a}function pa(){var a=Aa(["\n \n ","\n \n "]);return pa=function(){return a},a}function qa(){var a=Aa(["\n \n "]);return qa=function(){return a},a}function ra(){var a=Aa(["\n \n ","\n \n "]);return ra=function(){return a},a}function sa(){var a=Aa(["\n \n \n \n\n \n \n\n \n \n \n \n "]);return sa=function(){return a},a}function ta(){var a=Aa(["\n \n ","\n \n "]);return ta=function(){return a},a}function ua(){var a=Aa(["\n \n "]);return ua=function(){return a},a}function va(){var a=Aa([""]);return va=function(){return a},a}function wa(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function xa(a){for(var b,c=1;c div {\n padding: 0px 16px 16px 16px;\n }\n ha-card > div:last-child {\n padding-bottom: 0;\n }\n ha-card .graph {\n padding: 0;\n order: 10;\n }\n ha-card[points] .line--points,\n ha-card[labels] .graph__labels.--primary {\n opacity: 0;\n transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n animation: none;\n }\n ha-card[labels-secondary] .graph__labels.--secondary {\n opacity: 0;\n transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n animation: none;\n }\n ha-card[points]:hover .line--points,\n ha-card:hover .graph__labels.--primary,\n ha-card:hover .graph__labels.--secondary {\n opacity: 1;\n }\n ha-card[fill] path {\n stroke-linecap: initial;\n stroke-linejoin: initial;\n }\n ha-card .graph__legend {\n order: -1;\n padding: 0 16px 8px 16px;\n }\n ha-card[group] {\n padding: 0;\n }\n ha-card[group] > div {\n padding-left: 0;\n padding-right: 0;\n }\n ha-card[group] .graph__legend {\n padding-left: 0;\n padding-right: 0;\n }\n ha-card[hover] {\n cursor: pointer;\n }\n ha-card:hover {\n box-shadow:\n 0 8px 25px rgba(0, 0, 0, 0.15),\n 0 4px 10px rgba(0, 0, 0, 0.08),\n 0 0 0 1px rgba(255, 255, 255, 0.1);\n transform: translateY(-2px);\n }\n ha-card[hover]:hover {\n box-shadow:\n 0 12px 35px rgba(0, 0, 0, 0.2),\n 0 6px 15px rgba(0, 0, 0, 0.12),\n 0 0 0 1px rgba(255, 255, 255, 0.15);\n transform: translateY(-4px);\n }\n ha-spinner {\n margin: 4px auto;\n }\n .flex {\n display: flex;\n display: -webkit-flex;\n min-width: 0;\n }\n .header {\n justify-content: space-between;\n }\n .header[loc=\"center\"] {\n justify-content: space-around;\n }\n .header[loc=\"left\"] {\n align-self: flex-start;\n }\n .header[loc=\"right\"] {\n align-self: flex-end;\n }\n .name {\n align-items: center;\n min-width: 0;\n letter-spacing: var(--mcg-title-letter-spacing, normal);\n }\n .name > span {\n font-size: 1.2em;\n font-weight: var(--mcg-title-font-weight, 500);\n max-height: 1.4em;\n min-height: 1.4em;\n opacity: .65;\n }\n .icon {\n color: var(--state-icon-color, #44739e);\n display: inline-block;\n flex: 0 0 1.7em;\n text-align: center;\n }\n .icon > ha-icon {\n height: 1.7em;\n width: 1.7em;\n }\n .icon[loc=\"left\"] {\n order: -1;\n margin-right: .6em;\n margin-left: 0;\n }\n .icon[loc=\"state\"] {\n align-self: center;\n }\n .states {\n align-items: flex-start;\n font-weight: 300;\n justify-content: space-between;\n flex-wrap: nowrap;\n }\n .states .icon {\n align-self: center;\n margin-left: 0;\n }\n .states[loc=\"center\"] {\n justify-content: space-evenly;\n }\n .states[loc=\"right\"] > .state {\n margin-left: auto;\n order: 2;\n }\n .states[loc=\"center\"] .states--secondary,\n .states[loc=\"right\"] .states--secondary {\n margin-left: 0;\n }\n .states[loc=\"center\"] .states--secondary {\n align-items: center;\n }\n .states[loc=\"right\"] .states--secondary {\n align-items: flex-start;\n }\n .states[loc=\"center\"] .state__time {\n left: 50%;\n transform: translateX(-50%);\n }\n .states > .icon > ha-icon {\n height: 2em !important;\n width: 2em !important;\n }\n .states--secondary {\n display: flex;\n flex-flow: column;\n flex-wrap: wrap;\n align-items: flex-end;\n margin-left: 1rem;\n min-width: 0;\n margin-left: 1.4em;\n }\n .states--secondary:empty {\n display: none;\n }\n .state {\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n max-width: 100%;\n min-width: 0;\n }\n .state > svg {\n align-self: center;\n border-radius: 100%;\n }\n .state--small {\n font-size: .6em;\n margin-bottom: .6rem;\n flex-wrap: nowrap;\n }\n .state--small > svg {\n position: absolute;\n left: -1.6em;\n align-self: center;\n height: 1em;\n width: 1em;\n border-radius: 100%;\n margin-right: 1em;\n }\n .state--small:last-child {\n margin-bottom: 0;\n }\n .states--secondary > :only-child {\n font-size: 1em;\n margin-bottom: 0;\n }\n .states--secondary > :only-child svg {\n display: none;\n }\n .state__value {\n display: inline-block;\n font-size: 2.4em;\n margin-right: .25rem;\n line-height: 1.2em;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n .state__uom {\n flex: 1;\n align-self: flex-end;\n display: inline-block;\n font-size: 1.4em;\n font-weight: 400;\n line-height: 1.6em;\n margin-top: .1em;\n opacity: .6;\n vertical-align: bottom;\n }\n .state--small .state__uom {\n flex: 1;\n }\n .state__time {\n font-size: .95rem;\n font-weight: 500;\n bottom: -1.1rem;\n left: 0;\n opacity: .75;\n position: absolute;\n white-space: nowrap;\n animation: fade 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n }\n .states[loc=\"right\"] .state__time {\n left: initial;\n right: 0;\n }\n .graph {\n align-self: flex-end;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n margin-top: auto;\n width: 100%;\n }\n .graph__container {\n display: flex;\n flex-direction: row;\n position: relative;\n }\n .graph__container__svg {\n cursor: default;\n flex: 1;\n }\n svg {\n overflow: hidden;\n display: block;\n }\n path {\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n .fill[anim=\"false\"] {\n animation: reveal .25s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;\n }\n .fill[anim=\"false\"][type=\"fade\"] {\n animation: reveal-2 .25s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;\n }\n .line--points[anim=\"false\"],\n .line[anim=\"false\"] {\n animation: pop .25s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;\n }\n .line--points[inactive],\n .line--rect[inactive],\n .fill--rect[inactive] {\n opacity: 0 !important;\n animation: none !important;\n transition: all .15s !important;\n }\n .line--points[tooltip] .line--point[inactive] {\n opacity: 0;\n }\n .line--point {\n cursor: pointer;\n fill: var(--primary-background-color, white);\n stroke-width: inherit;\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n }\n .line--point:hover {\n fill: var(--mcg-hover, inherit) !important;\n transform: scale(1.15);\n filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));\n }\n .bars {\n animation: pop .25s cubic-bezier(0.215, 0.61, 0.355, 1);\n }\n .bars[anim] {\n animation: bars .5s cubic-bezier(0.215, 0.61, 0.355, 1);\n }\n .bar {\n transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);\n }\n .bar:hover {\n opacity: 0.8;\n cursor: pointer;\n filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));\n transform: translateY(-1px);\n }\n ha-card[gradient] .line--point:hover {\n fill: var(--primary-text-color, white);\n }\n path,\n .line--points,\n .fill {\n opacity: 0;\n }\n .line--points[anim=\"true\"][init] {\n animation: pop .5s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;\n }\n .fill[anim=\"true\"][init] {\n animation: reveal .5s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;\n }\n .fill[anim=\"true\"][init][type=\"fade\"] {\n animation: reveal-2 .5s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;\n }\n .line[anim=\"true\"][init] {\n animation: dash 1s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;\n }\n .graph__labels.--secondary {\n right: 0;\n margin-right: 0px;\n align-items: flex-end;\n }\n .graph__labels {\n align-items: flex-start;\n flex-direction: column;\n font-size: calc(.15em + 8.5px);\n font-weight: 400;\n justify-content: space-between;\n margin-right: 10px;\n padding: .6em;\n position: absolute;\n pointer-events: none;\n top: 0; bottom: 0;\n opacity: .75;\n }\n .graph__labels > span {\n cursor: pointer;\n background: var(--primary-background-color, white);\n border-radius: 0.75em;\n padding: .3em .8em;\n box-shadow:\n 0 2px 4px rgba(0, 0, 0, 0.08),\n 0 1px 2px rgba(0, 0, 0, 0.04);\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n backdrop-filter: blur(8px);\n border: 1px solid rgba(255, 255, 255, 0.15);\n }\n .graph__labels > span:hover {\n box-shadow:\n 0 4px 8px rgba(0, 0, 0, 0.12),\n 0 2px 4px rgba(0, 0, 0, 0.08);\n transform: translateY(-1px);\n background: var(--card-background-color, white);\n }\n .graph__legend {\n display: flex;\n flex-direction: row;\n justify-content: space-evenly;\n padding-top: 16px;\n flex-wrap: wrap;\n }\n .graph__legend__item {\n cursor: pointer;\n display: flex;\n min-width: 0;\n margin: .4em;\n align-items: center;\n padding: 0.3em 0.6em;\n border-radius: 0.5em;\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n }\n .graph__legend__item:hover {\n background: rgba(255, 255, 255, 0.05);\n transform: translateY(-1px);\n box-shadow:\n 0 2px 4px rgba(0, 0, 0, 0.08),\n 0 1px 2px rgba(0, 0, 0, 0.04);\n }\n .graph__legend__item span {\n opacity: .75;\n margin-left: .4em;\n }\n .graph__legend__item svg {\n border-radius: 100%;\n min-width: 10px;\n }\n .info {\n justify-content: space-between;\n align-items: middle;\n }\n .info__item {\n display: flex;\n flex-flow: column;\n text-align: center;\n }\n .info__item:last-child {\n align-items: flex-end;\n text-align: right;\n }\n .info__item:first-child {\n align-items: flex-start;\n text-align: left;\n }\n .info__item__type {\n text-transform: capitalize;\n font-weight: 500;\n opacity: .9;\n }\n .info__item__time,\n .info__item__value {\n opacity: .75;\n }\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n @keyframes fade {\n 0% {\n opacity: 0;\n transform: translateY(4px);\n }\n 100% {\n opacity: 0.75;\n transform: translateY(0);\n }\n }\n @keyframes reveal {\n 0% { opacity: 0; }\n 100% { opacity: .15; }\n }\n @keyframes reveal-2 {\n 0% { opacity: 0; }\n 100% { opacity: .4; }\n }\n @keyframes pop {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n }\n @keyframes bars {\n 0% { opacity: 0; }\n 50% { opacity: 0; }\n 100% { opacity: 1; }\n }\n @keyframes dash {\n 0% {\n opacity: 0;\n }\n 25% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n stroke-dashoffset: 0;\n }\n }"]);return za=function(){return a},a}function Aa(a,b){return b||(b=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(b)}}))}function Ba(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function Ca(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){Ba(h,d,e,f,g,"next",a)}function g(a){Ba(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function Da(a){return Ha(a)||Ga(a)||Fa(a)||Ea()}function Ea(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Fa(a,b){if(a){if("string"==typeof a)return Ia(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?Ia(a,b):void 0}}function Ga(a){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a))return Array.from(a)}function Ha(a){if(Array.isArray(a))return Ia(a)}function Ia(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);ca.parentNode.removeChild(a))}function wa(a,b){var c=2=b.oldVersion&&c.createObjectStore("local-forage-detect-blob-support")}catch(c){if("ConstraintError"===c.name)console.warn("The database \""+a.name+"\" has been upgraded from version "+b.oldVersion+" to version "+b.newVersion+", but the storage \""+a.storeName+"\" already exists.");else throw c}}),f.onerror=function(a){a.preventDefault(),d(f.error)},f.onsuccess=function(){c(f.result),La(a)}})}function Oa(a){return Na(a,!1)}function Pa(a){return Na(a,!0)}function Qa(a,b){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),d=a.versiona.db.version;if(d&&(a.version!==b&&console.warn("The database \""+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),e||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function Ra(a){return new Bd(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function Sa(a){var b=Ha(atob(a.data));return Aa([b],{type:a.type})}function Ta(a){return a&&a.__local_forage_encoded_blob}function Ua(a){var b=this,c=b._initReady().then(function(){var a=Cd[b._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return Ea(c,a,a),c}function Va(a){Ka(a);for(var b,c=Cd[a.name],d=c.forages,e=0;e(a.db=b,Qa(a)?Pa(a):b)).then(b=>{a.db=c.db=b;for(var e=0;e{throw Ma(a,b),b})}function Wa(a,b,c,d){d===void 0&&(d=1);try{var e=a.db.transaction(a.storeName,b);c(null,e)}catch(e){if(0{if(!a.db||"NotFoundError"===e.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),Pa(a)}).then(()=>Va(a).then(function(){Wa(a,b,c,d-1)})).catch(c);c(e)}}function Xa(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ya(a){var b,c,d,e,f,g=.75*a.length,h=a.length,j=0;"="===a[a.length-1]&&(g--,"="===a[a.length-2]&&g--);var k=new ArrayBuffer(g),l=new Uint8Array(k);for(b=0;b>4,l[j++]=(15&d)<<4|e>>2,l[j++]=(3&e)<<6|63&f;return k}function Za(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&c[b])<<4|c[b+1]>>4],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&c[b+1])<<2|c[b+2]>>6],d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&c[b+2]];return 2==c.length%3?d=d.substring(0,d.length-1)+"=":1==c.length%3&&(d=d.substring(0,d.length-2)+"=="),d}function $a(a,b,c,d){a.executeSql("CREATE TABLE IF NOT EXISTS ".concat(b.storeName," ")+"(id INTEGER PRIMARY KEY, key unique, value)",[],c,d)}function ab(a,b,c,d,e,f){a.executeSql(c,d,e,function(a,g){g.code===g.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,h){h.rows.length?f(a,g):$a(a,b,function(){a.executeSql(c,d,e,f)},f)},f):f(a,g)},f)}function bb(a,b,c,d){var e=this;a=Fa(a);var f=new Bd(function(f,g){e.ready().then(function(){void 0===b&&(b=null);var h=b,i=e._dbInfo;i.serializer.serialize(b,function(b,j){j?g(j):i.db.transaction(function(c){ab(c,i,"INSERT OR REPLACE INTO ".concat(i.storeName," ")+"(key, value) VALUES (?, ?)",[a,b],function(){f(h)},function(a,b){g(b)})},function(b){if(b.code===b.QUOTA_ERR){if(0 '__WebKitDatabaseInfoTable__'",[],function(c,d){for(var e=[],f=0;f>8|240&b>>4,15&b>>4|240&b,(15&b)<<4|15&b,1):8===c?vb(255&b>>24,255&b>>16,255&b>>8,(255&b)/255):4===c?vb(15&b>>12|240&b>>8,15&b>>8|240&b>>4,15&b>>4|240&b,((15&b)<<4|15&b)/255):null):(b=Ke.exec(a))?new yb(b[1],b[2],b[3],1):(b=Le.exec(a))?new yb(255*b[1]/100,255*b[2]/100,255*b[3]/100,1):(b=Me.exec(a))?vb(b[1],b[2],b[3],b[4]):(b=Ne.exec(a))?vb(255*b[1]/100,255*b[2]/100,255*b[3]/100,b[4]):(b=Oe.exec(a))?Eb(b[1],b[2]/100,b[3]/100,1):(b=Pe.exec(a))?Eb(b[1],b[2]/100,b[3]/100,b[4]):Qe.hasOwnProperty(a)?ub(Qe[a]):"transparent"===a?new yb(NaN,NaN,NaN,0):null}function ub(a){return new yb(255&a>>16,255&a>>8,255&a,1)}function vb(c,d,e,f){return 0>=f&&(c=d=e=NaN),new yb(c,d,e,f)}function wb(a){return(a instanceof qb||(a=tb(a)),!a)?new yb:(a=a.rgb(),new yb(a.r,a.g,a.b,a.opacity))}function xb(a,c,d,b){return 1===arguments.length?wb(a):new yb(a,c,d,null==b?1:b)}function yb(a,c,d,b){this.r=+a,this.g=+c,this.b=+d,this.opacity=+b}function zb(){return"#".concat(Db(this.r)).concat(Db(this.g)).concat(Db(this.b))}function Ab(){var b=Bb(this.opacity);return"".concat(1===b?"rgb(":"rgba(").concat(Cb(this.r),", ").concat(Cb(this.g),", ").concat(Cb(this.b)).concat(1===b?")":", ".concat(b,")"))}function Bb(a){return isNaN(a)?1:lc(0,mc(1,a))}function Cb(a){return lc(0,mc(255,kc(a)||0))}function Db(a){return a=Cb(a),(16>a?"0":"")+a.toString(16)}function Eb(b,c,d,e){return 0>=e?b=c=d=NaN:0>=d||1<=d?b=c=NaN:0>=c&&(b=NaN),new Gb(b,c,d,e)}function Fb(a){if(a instanceof Gb)return new Gb(a.h,a.s,a.l,a.opacity);if(a instanceof qb||(a=tb(a)),!a)return new Gb;if(a instanceof Gb)return a;a=a.rgb();var c=a.r/255,d=a.g/255,e=a.b/255,b=mc(c,d,e),f=lc(c,d,e),g=NaN,i=f-b,j=(f+b)/2;return i?(g=c===f?(d-e)/i+6*(dj?f+b:2-f-b,g*=60):i=0j?0:g,new Gb(g,i,j,a.opacity)}function Gb(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}function Hb(a){return a=(a||0)%360,0>a?a+360:a}function Ib(a){return lc(0,mc(1,a||0))}function Jb(a,b,c){return 255*(60>a?b+(c-b)*a/60:180>a?c:240>a?b+(c-b)*(240-a)/60:b)}function Kb(a){if(a instanceof Lb)return new Lb(a.l,a.a,a.b,a.opacity);if(a instanceof Rb)return Sb(a);a instanceof yb||(a=wb(a));var c,d,e=Pb(a.r),f=Pb(a.g),g=Pb(a.b),b=Mb((.2225045*e+.7168786*f+.0606169*g)/1);return e===f&&f===g?c=d=b:(c=Mb((.4360747*e+.3850649*f+.1430804*g)/Ue),d=Mb((.0139322*e+.0971045*f+.7141733*g)/Ve)),new Lb(116*b-16,500*(c-b),200*(b-d),a.opacity)}function Lb(c,d,a,b){this.l=+c,this.a=+d,this.b=+a,this.opacity=+b}function Mb(a){return a>Ze?jc(a,1/3):a/Ye+We}function Nb(a){return a>Xe?a*a*a:Ye*(a-We)}function Ob(a){return 255*(.0031308>=a?12.92*a:1.055*jc(a,1/2.4)-.055)}function Pb(a){return .04045>=(a/=255)?a/12.92:jc((a+.055)/1.055,2.4)}function Qb(a){if(a instanceof Rb)return new Rb(a.h,a.c,a.l,a.opacity);if(a instanceof Lb||(a=Kb(a)),0===a.a&&0===a.b)return new Rb(NaN,0a.l?0:NaN,a.l,a.opacity);var b=ic(a.b,a.a)*Se;return new Rb(0>b?b+360:b,hc(a.a*a.a+a.b*a.b),a.l,a.opacity)}function Rb(a,b,c,d){this.h=+a,this.c=+b,this.l=+c,this.opacity=+d}function Sb(a){if(isNaN(a.h))return new Lb(a.l,0,0,a.opacity);var b=a.h*Re;return new Lb(a.l,gc(b)*a.c,fc(b)*a.c,a.opacity)}function Tb(a){if(a instanceof Ub)return new Ub(a.h,a.s,a.l,a.opacity);a instanceof yb||(a=wb(a));var c=a.r/255,d=a.g/255,e=a.b/255,b=(ff*e+df*c-ef*d)/(ff+df-ef),f=e-b,g=(cf*(d-b)-af*f)/bf,i=hc(g*g+f*f)/(cf*b*(1-b)),j=i?ic(g,f)*Se-120:NaN;return new Ub(0>j?j+360:j,i,b,a.opacity)}function Ub(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}function Vb(b,a){return function(c){return b+c*a}}function Wb(c,d,e){return c=jc(c,e),d=jc(d,e)-c,e=1/e,function(a){return jc(c+a*d,e)}}function Xb(c){return 1==(c=+c)?Yb:function(d,a){return a-d?Wb(d,a,c):gf(isNaN(d)?a:d)}}function Yb(c,a){var b=a-c;return b?Vb(c,b):gf(isNaN(c)?a:c)}function Zb(a){return Tf||(Tf=new Rf(a)),Tf}var nc="undefined"!=typeof window&&null!=window.customElements&&window.customElements.polyfillWrapFlushCallback!==void 0,oc=function(a,b){for(var c=2"),sc=new RegExp("".concat(qc,"|").concat(rc)),tc="$lit$";class uc{constructor(a,b){this.parts=[],this.element=b;for(var c,d=[],e=[],f=document.createTreeWalker(b.content,133,null,!1),g=0,h=-1,j=0,{strings:k,values:{length:l}}=a;j{var c=a.length-b.length;return 0<=c&&a.slice(c)===b},wc=a=>-1!==a.index,xc=()=>document.createComment(""),yc=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,zc=a=>{for(var b=11===a.nodeType?0:1,c=document.createTreeWalker(a,133,null,!1);c.nextNode();)b++;return b},Ac=function(a){for(var b,c=1"function"==typeof a&&Bc.has(a),Dc={},Ec={};class Fc{constructor(a,b,c){this.__parts=[],this.template=a,this.processor=b,this.options=c}update(a){var b=0;for(var c of this.__parts)void 0!==c&&c.setValue(a[b]),b++;for(var d of this.__parts)void 0!==d&&d.commit()}_clone(){for(var a,b=nc?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),c=[],d=this.template.parts,e=document.createTreeWalker(b,133,null,!1),f=0,g=0,h=e.nextNode();fa}),Hc=" ".concat(qc," ");class Ic{constructor(a,b,c,d){this.strings=a,this.values=b,this.type=c,this.processor=d}getHTML(){for(var a=this.strings.length-1,b="",c=!1,d=0;d",f+1);var g=yc.exec(e);b+=null===g?e+(c?Hc:rc):e.substr(0,g.index)+g[1]+g[2]+tc+g[3]+qc}return b+=this.strings[a],b}getTemplateElement(){var a=document.createElement("template"),b=this.getHTML();return void 0!==Gc&&(b=Gc.createHTML(b)),a.innerHTML=b,a}}class Jc extends Ic{getHTML(){return"".concat(super.getHTML(),"")}getTemplateElement(){var a=super.getTemplateElement(),b=a.content,c=b.firstChild;return b.removeChild(c),oc(b,c.firstChild),a}}var Kc=a=>null===a||"object"!=typeof a&&"function"!=typeof a,Lc=a=>Array.isArray(a)||!!(a&&a[Symbol.iterator]);class Mc{constructor(a,b,c){this.dirty=!0,this.element=a,this.name=b,this.strings=c,this.parts=[];for(var d=0;d{try{var a={get capture(){return Sc=!0,!1}};window.addEventListener("test",a,a),window.removeEventListener("test",a,a)}catch(a){}})();class Tc{constructor(a,b,c){this.value=void 0,this.__pendingValue=void 0,this.element=a,this.eventName=b,this.eventContext=c,this.__boundHandleEvent=a=>this.handleEvent(a)}setValue(a){this.__pendingValue=a}commit(){for(;Cc(this.__pendingValue);){var d=this.__pendingValue;this.__pendingValue=Dc,d(this)}if(this.__pendingValue!==Dc){var a=this.__pendingValue,b=this.value,c=null==a||null!=b&&(a.capture!==b.capture||a.once!==b.once||a.passive!==b.passive);c&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),null!=a&&(null==b||c)&&(this.__options=Uc(a),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=a,this.__pendingValue=Dc}}handleEvent(a){"function"==typeof this.value?this.value.call(this.eventContext||this.element,a):this.value.handleEvent(a)}}var Uc=a=>a&&(Sc?{capture:a.capture,passive:a.passive,once:a.once}:a.capture),Vc=new Map,Wc=new WeakMap,Xc=(a,b,c)=>{var d=Wc.get(b);d===void 0&&(pc(b,b.firstChild),Wc.set(b,d=new Oc(Object.assign({templateFactory:ya},c))),d.appendInto(b)),d.setValue(a),d.commit()};var Yc=new class a{handleAttributeExpressions(a,b,c,d){var e=b[0];if("."===e){var g=new Qc(a,b.slice(1),c);return g.parts}if("@"===e)return[new Tc(a,b.slice(1),d.eventContext)];if("?"===e)return[new Pc(a,b.slice(1),c)];var f=new Mc(a,b,c);return f.parts}handleTextExpression(a){return new Oc(a)}};"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var Zc=function(a){for(var b=arguments.length,c=Array(1"".concat(a,"--").concat(b),ad=!0;"undefined"==typeof window.ShadyCSS?ad=!1:"undefined"==typeof window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),ad=!1);var bd,cd=a=>b=>{var c=_c(b.type,a),d=Vc.get(c);void 0===d&&(d={stringsArray:new WeakMap,keyString:new Map},Vc.set(c,d));var e=d.stringsArray.get(b.strings);if(void 0!==e)return e;var f=b.strings.join(qc);if(e=d.keyString.get(f),void 0===e){var g=b.getTemplateElement();ad&&window.ShadyCSS.prepareTemplateDom(g,a),e=new uc(b,g),d.keyString.set(f,e)}return d.stringsArray.set(b.strings,e),e},dd=["html","svg"],ed=a=>{dd.forEach(b=>{var c=Vc.get(_c(b,a));c!==void 0&&c.keyString.forEach(a=>{var{element:{content:b}}=a,c=new Set;Array.from(b.querySelectorAll("style")).forEach(a=>{c.add(a)}),i(a,c)})})},fd=new Set,gd=(a,b,c)=>{fd.add(a);var d=!c?document.createElement("template"):c.element,e=b.querySelectorAll("style"),{length:f}=e;if(0===f)return void window.ShadyCSS.prepareTemplateStyles(d,a);for(var g,h=document.createElement("style"),j=0;j{if(!c||"object"!=typeof c||!c.scopeName)throw new Error("The `scopeName` option is required.");var d=c.scopeName,e=Wc.has(b),f=ad&&11===b.nodeType&&!!b.host,g=f&&!fd.has(d),h=g?document.createDocumentFragment():b;if(Xc(a,h,Object.assign({templateFactory:cd(d)},c)),g){var i=Wc.get(h);Wc.delete(h);var j=i.value instanceof Fc?i.value.template:void 0;gd(d,h,j),pc(b,b.firstChild),b.appendChild(h),Wc.set(b,i)}!e&&f&&window.ShadyCSS.styleElement(b.host)};window.JSCompiler_renameProperty=a=>a;var id={toAttribute(a,b){return b===Boolean?a?"":null:b===Object||b===Array?null==a?a:JSON.stringify(a):a},fromAttribute(a,b){return b===Boolean?null!==a:b===Number?null===a?null:+a:b===Object||b===Array?JSON.parse(a):a}},jd=(a,b)=>b!==a&&(b===b||a===a),kd={attribute:!0,type:String,converter:id,reflect:!1,hasChanged:jd},ld=1,md=4,nd=8,od=16,pd="finalized";class qd extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();var a=[];return this._classProperties.forEach((b,c)=>{var d=this._attributeNameForProperty(c,b);void 0!==d&&(this._attributeToPropertyMap.set(d,c),a.push(d))}),a}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;var a=Object.getPrototypeOf(this)._classProperties;a!==void 0&&a.forEach((a,b)=>this._classProperties.set(b,a))}}static createProperty(a){var b=1this._enableUpdatingResolver=a),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((a,b)=>{if(this.hasOwnProperty(b)){var c=this[b];delete this[b],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(b,c)}})}_applyInstanceProperties(){this._instanceProperties.forEach((a,b)=>this[b]=a),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(a,b,c){b!==c&&this._attributeToProperty(a,c)}_propertyToAttribute(a,b){var c=2this._propertyToAttribute(b,this[b],a)),this._reflectingProperties=void 0),this._markUpdated()}updated(){}firstUpdated(){}}bd=pd,qd[bd]=!0;var rd=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,sd=Symbol();class td{constructor(a,b){if(b!==sd)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=a}get styleSheet(){return void 0===this._styleSheet&&(rd?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}var ud=a=>new td(a+"",sd),vd=a=>{if(a instanceof td)return a.cssText;if("number"==typeof a)return a;throw new Error("Value passed to 'css' function must be a 'css' function result: ".concat(a,". Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security."))},wd=function(a){for(var b=arguments.length,c=Array(1b+vd(c)+a[d+1],a[0]);return new td(e,sd)};(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var xd={};class yd extends qd{static getStyles(){return this.styles}static _getUniqueStyles(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_styles",this))){var a=this.getStyles();if(Array.isArray(a)){var b=(a,c)=>a.reduceRight((a,c)=>Array.isArray(c)?b(c,a):(a.add(c),a),c),c=b(a,new Set),d=[];c.forEach(a=>d.unshift(a)),this._styles=d}else this._styles=void 0===a?[]:[a];this._styles=this._styles.map(a=>{if(a instanceof CSSStyleSheet&&!rd){var b=Array.prototype.slice.call(a.cssRules).reduce((a,b)=>a+b.cssText,"");return ud(b)}return a})}}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){var a=this.constructor._styles;0===a.length||(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow?rd?this.renderRoot.adoptedStyleSheets=a.map(a=>a instanceof CSSStyleSheet?a:a.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(a.map(a=>a.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(a){var b=this.render();super.update(a),b!==xd&&this.constructor.render(b,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(a=>{var b=document.createElement("style");b.textContent=a.cssText,this.renderRoot.appendChild(b)}))}render(){return xd}}yd.finalized=!0,yd.render=hd;var zd=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(a){}}();"undefined"==typeof Promise&&require("lie/polyfill");var Ad,Bd=Promise,Cd={},Dd=Object.prototype.toString,Ed={_driver:"asyncStorage",_initStorage:function(a){function b(){return Bd.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];var f=Cd[d.name];f||(f=Xa(),Cd[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=Ua);for(var g,h=[],i=0;ia?void b(null):void c.ready().then(function(){Wa(c._dbInfo,"readonly",function(e,f){if(e)return d(e);try{var g=f.objectStore(c._dbInfo.storeName),h=!1,i=g.openKeyCursor();i.onsuccess=function(){var c=i.result;return c?void(0===a?b(c.key):h?b(c.key):(h=!0,c.advance(a))):void b(null)},i.onerror=function(){d(i.error)}}catch(a){d(a)}})}).catch(d)});return Ba(d,b),d},keys:function(a){var b=this,c=new Bd(function(a,c){b.ready().then(function(){Wa(b._dbInfo,"readonly",function(d,e){if(d)return c(d);try{var f=e.objectStore(b._dbInfo.storeName),g=f.openKeyCursor(),h=[];g.onsuccess=function(){var b=g.result;return b?void(h.push(b.key),b.continue()):void a(h)},g.onerror=function(){c(g.error)}}catch(a){c(a)}})}).catch(c)});return Ba(c,a),c},dropInstance:function(a,b){b=Ga.apply(this,arguments);var c=this.config();a="function"!=typeof a&&a||{},a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var d,e=this;if(!a.name)d=Bd.reject("Invalid arguments");else{var f=a.name===c.name&&e._dbInfo.db,g=f?Bd.resolve(e._dbInfo.db):Oa(a).then(b=>{var c=Cd[a.name],d=c.forages;c.db=b;for(var e=0;e{if(b.objectStoreNames.contains(a.storeName)){var c=b.version+1;Ka(a);var d=Cd[a.name],e=d.forages;b.close();for(var g,h=0;h{var e=zd.open(a.name,c);e.onerror=a=>{var b=e.result;b.close(),d(a)},e.onupgradeneeded=()=>{var b=e.result;b.deleteObjectStore(a.storeName)},e.onsuccess=()=>{var a=e.result;a.close(),b(a)}});return f.then(a=>{d.db=a;for(var b,c=0;c{throw(Ma(a,b)||Bd.resolve()).catch(()=>{}),b})}}):g.then(b=>{Ka(a);var c=Cd[a.name],d=c.forages;b.close();for(var e,f=0;f{var d=zd.deleteDatabase(a.name);d.onerror=d.onblocked=a=>{var b=d.result;b&&b.close(),c(a)},d.onsuccess=()=>{var a=d.result;a&&a.close(),b(a)}});return g.then(a=>{c.db=a;for(var b,e=0;e{throw(Ma(a,b)||Bd.resolve()).catch(()=>{}),b})})}return Ba(d,b),d}},Fd=/^~~local_forage_type~([^~]+)~/,Gd="__lfsc__:".length,Hd=Gd+"arbf".length,Id=Object.prototype.toString,Jd={serialize:function(a,b){var c="";if(a&&(c=Id.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===Id.call(a.buffer))){var d,e="__lfsc__:";a instanceof ArrayBuffer?(d=a,e+="arbf"):(d=a.buffer,"[object Int8Array]"===c?e+="si08":"[object Uint8Array]"===c?e+="ui08":"[object Uint8ClampedArray]"===c?e+="uic8":"[object Int16Array]"===c?e+="si16":"[object Uint16Array]"===c?e+="ur16":"[object Int32Array]"===c?e+="si32":"[object Uint32Array]"===c?e+="ui32":"[object Float32Array]"===c?e+="fl32":"[object Float64Array]"===c?e+="fl64":b(new Error("Failed to get type for BinaryArray"))),b(e+Za(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c="~~local_forage_type~"+a.type+"~"+Za(this.result);b("__lfsc__:blob"+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}},deserialize:function(a){if(a.substring(0,Gd)!=="__lfsc__:")return JSON.parse(a);var b,c=a.substring(Hd),d=a.substring(Gd,Hd);if(d==="blob"&&Fd.test(c)){var e=c.match(Fd);b=e[1],c=c.substring(e[0].length)}var f=Ya(c);switch(d){case"arbf":return f;case"blob":return Aa([f],{type:b});case"si08":return new Int8Array(f);case"ui08":return new Uint8Array(f);case"uic8":return new Uint8ClampedArray(f);case"si16":return new Int16Array(f);case"ur16":return new Uint16Array(f);case"si32":return new Int32Array(f);case"ui32":return new Uint32Array(f);case"fl32":return new Float32Array(f);case"fl64":return new Float64Array(f);default:throw new Error("Unkown type: "+d);}},stringToBuffer:Ya,bufferToString:Za},Kd={_driver:"webSQLStorage",_initStorage:function(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"==typeof a[d]?a[d]:a[d].toString();var e=new Bd(function(a,d){try{c.db=openDatabase(c.name,c.version+"",c.description,c.size)}catch(a){return d(a)}c.db.transaction(function(e){$a(e,c,function(){b._dbInfo=c,a()},function(a,b){d(b)})},d)});return c.serializer=Jd,e},_support:function(){return"function"==typeof openDatabase}(),iterate:function(a,b){var c=this,d=new Bd(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){ab(c,e,"SELECT * FROM ".concat(e.storeName),[],function(c,d){for(var f=d.rows,g=f.length,h=0;ha===b||"number"==typeof a&&"number"==typeof b&&isNaN(a)&&isNaN(b),Nd=(a,b)=>{for(var c=a.length,d=0;d{})}config(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a){if("storeName"==b&&(a[b]=a[b].replace(/\W/g,"_")),"version"==b&&"number"!=typeof a[b])return new Error("Database version must be a number.");this._config[b]=a[b]}return!("driver"in a&&a.driver)||this.setDriver(this._config.driver)}return"string"==typeof a?this._config[a]:this._config}defineDriver(a,b,c){var d=new Bd(function(b,c){try{var d=a._driver,e=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!a._driver)return void c(e);for(var f=Ud.concat("_initStorage"),g=0,h=f.length;g(null===b._ready&&(b._ready=b._initDriver()),b._ready));return Ea(c,a,a),c}setDriver(a,b,c){function d(){g._config.driver=g.driver()}function e(a){return g._extend(a),d(),g._ready=g._initStorage(g._config),g._ready}function f(a){return function(){function b(){for(;cBd.resolve());return this._driverSet=i.then(()=>{var a=h[0];return g._dbInfo=null,g._ready=null,g.getDriver(a).then(a=>{g._driver=a._driver,d(),g._wrapLibraryMethodsWithReady(),g._initDriver=f(h)})}).catch(()=>{d();var a=new Error("No available storage method found.");return g._driverSet=Bd.reject(a),g._driverSet}),Ea(this._driverSet,b,c),this._driverSet}supports(a){return!!Qd[a]}_extend(a){ib(this,a)}_getSupportedDrivers(a){for(var b,c=[],d=0,e=a.length;da.getHours()?b.amPm[0]:b.amPm[1]},A:function(a,b){return 12>a.getHours()?b.amPm[0].toUpperCase():b.amPm[1].toUpperCase()},ZZ:function(a){var b=a.getTimezoneOffset();return(0=a?"hass:battery-alert":"hass:battery-"+a}var e=b.attributes.unit_of_measurement;return"\xB0C"===e||"\xB0F"===e?"hass:thermometer":nb("sensor")},input_datetime:function(a){return a.attributes.has_date?a.attributes.has_time?nb("input_datetime"):"hass:calendar":"hass:clock"}},Ce=function(a){if(!a)return"hass:bookmark";if(a.attributes.icon)return a.attributes.icon;var b=mb(a.entity_id);return b in Be?Be[b](a):nb(b,a.state)},De=function(a){var b={exports:{}};return a(b,b.exports),b.exports}(function(a){(function(b){a.exports=b()})(function(a){function b(e,f){var g=e[0],h=e[1],i=e[2],j=e[3];g+=0|(h&i|~h&j)+f[0]-680876936,g=0|(g<<7|g>>>25)+h,j+=0|(g&h|~g&i)+f[1]-389564586,j=0|(j<<12|j>>>20)+g,i+=0|(j&g|~j&h)+f[2]+606105819,i=0|(i<<17|i>>>15)+j,h+=0|(i&j|~i&g)+f[3]-1044525330,h=0|(h<<22|h>>>10)+i,g+=0|(h&i|~h&j)+f[4]-176418897,g=0|(g<<7|g>>>25)+h,j+=0|(g&h|~g&i)+f[5]+1200080426,j=0|(j<<12|j>>>20)+g,i+=0|(j&g|~j&h)+f[6]-1473231341,i=0|(i<<17|i>>>15)+j,h+=0|(i&j|~i&g)+f[7]-45705983,h=0|(h<<22|h>>>10)+i,g+=0|(h&i|~h&j)+f[8]+1770035416,g=0|(g<<7|g>>>25)+h,j+=0|(g&h|~g&i)+f[9]-1958414417,j=0|(j<<12|j>>>20)+g,i+=0|(j&g|~j&h)+f[10]-42063,i=0|(i<<17|i>>>15)+j,h+=0|(i&j|~i&g)+f[11]-1990404162,h=0|(h<<22|h>>>10)+i,g+=0|(h&i|~h&j)+f[12]+1804603682,g=0|(g<<7|g>>>25)+h,j+=0|(g&h|~g&i)+f[13]-40341101,j=0|(j<<12|j>>>20)+g,i+=0|(j&g|~j&h)+f[14]-1502002290,i=0|(i<<17|i>>>15)+j,h+=0|(i&j|~i&g)+f[15]+1236535329,h=0|(h<<22|h>>>10)+i,g+=0|(h&j|i&~j)+f[1]-165796510,g=0|(g<<5|g>>>27)+h,j+=0|(g&i|h&~i)+f[6]-1069501632,j=0|(j<<9|j>>>23)+g,i+=0|(j&h|g&~h)+f[11]+643717713,i=0|(i<<14|i>>>18)+j,h+=0|(i&g|j&~g)+f[0]-373897302,h=0|(h<<20|h>>>12)+i,g+=0|(h&j|i&~j)+f[5]-701558691,g=0|(g<<5|g>>>27)+h,j+=0|(g&i|h&~i)+f[10]+38016083,j=0|(j<<9|j>>>23)+g,i+=0|(j&h|g&~h)+f[15]-660478335,i=0|(i<<14|i>>>18)+j,h+=0|(i&g|j&~g)+f[4]-405537848,h=0|(h<<20|h>>>12)+i,g+=0|(h&j|i&~j)+f[9]+568446438,g=0|(g<<5|g>>>27)+h,j+=0|(g&i|h&~i)+f[14]-1019803690,j=0|(j<<9|j>>>23)+g,i+=0|(j&h|g&~h)+f[3]-187363961,i=0|(i<<14|i>>>18)+j,h+=0|(i&g|j&~g)+f[8]+1163531501,h=0|(h<<20|h>>>12)+i,g+=0|(h&j|i&~j)+f[13]-1444681467,g=0|(g<<5|g>>>27)+h,j+=0|(g&i|h&~i)+f[2]-51403784,j=0|(j<<9|j>>>23)+g,i+=0|(j&h|g&~h)+f[7]+1735328473,i=0|(i<<14|i>>>18)+j,h+=0|(i&g|j&~g)+f[12]-1926607734,h=0|(h<<20|h>>>12)+i,g+=0|(h^i^j)+f[5]-378558,g=0|(g<<4|g>>>28)+h,j+=0|(g^h^i)+f[8]-2022574463,j=0|(j<<11|j>>>21)+g,i+=0|(j^g^h)+f[11]+1839030562,i=0|(i<<16|i>>>16)+j,h+=0|(i^j^g)+f[14]-35309556,h=0|(h<<23|h>>>9)+i,g+=0|(h^i^j)+f[1]-1530992060,g=0|(g<<4|g>>>28)+h,j+=0|(g^h^i)+f[4]+1272893353,j=0|(j<<11|j>>>21)+g,i+=0|(j^g^h)+f[7]-155497632,i=0|(i<<16|i>>>16)+j,h+=0|(i^j^g)+f[10]-1094730640,h=0|(h<<23|h>>>9)+i,g+=0|(h^i^j)+f[13]+681279174,g=0|(g<<4|g>>>28)+h,j+=0|(g^h^i)+f[0]-358537222,j=0|(j<<11|j>>>21)+g,i+=0|(j^g^h)+f[3]-722521979,i=0|(i<<16|i>>>16)+j,h+=0|(i^j^g)+f[6]+76029189,h=0|(h<<23|h>>>9)+i,g+=0|(h^i^j)+f[9]-640364487,g=0|(g<<4|g>>>28)+h,j+=0|(g^h^i)+f[12]-421815835,j=0|(j<<11|j>>>21)+g,i+=0|(j^g^h)+f[15]+530742520,i=0|(i<<16|i>>>16)+j,h+=0|(i^j^g)+f[2]-995338651,h=0|(h<<23|h>>>9)+i,g+=0|(i^(h|~j))+f[0]-198630844,g=0|(g<<6|g>>>26)+h,j+=0|(h^(g|~i))+f[7]+1126891415,j=0|(j<<10|j>>>22)+g,i+=0|(g^(j|~h))+f[14]-1416354905,i=0|(i<<15|i>>>17)+j,h+=0|(j^(i|~g))+f[5]-57434055,h=0|(h<<21|h>>>11)+i,g+=0|(i^(h|~j))+f[12]+1700485571,g=0|(g<<6|g>>>26)+h,j+=0|(h^(g|~i))+f[3]-1894986606,j=0|(j<<10|j>>>22)+g,i+=0|(g^(j|~h))+f[10]-1051523,i=0|(i<<15|i>>>17)+j,h+=0|(j^(i|~g))+f[1]-2054922799,h=0|(h<<21|h>>>11)+i,g+=0|(i^(h|~j))+f[8]+1873313359,g=0|(g<<6|g>>>26)+h,j+=0|(h^(g|~i))+f[15]-30611744,j=0|(j<<10|j>>>22)+g,i+=0|(g^(j|~h))+f[6]-1560198380,i=0|(i<<15|i>>>17)+j,h+=0|(j^(i|~g))+f[13]+1309151649,h=0|(h<<21|h>>>11)+i,g+=0|(i^(h|~j))+f[4]-145523070,g=0|(g<<6|g>>>26)+h,j+=0|(h^(g|~i))+f[11]-1120210379,j=0|(j<<10|j>>>22)+g,i+=0|(g^(j|~h))+f[2]+718787259,i=0|(i<<15|i>>>17)+j,h+=0|(j^(i|~g))+f[9]-343485551,h=0|(h<<21|h>>>11)+i,e[0]=0|g+e[0],e[1]=0|h+e[1],e[2]=0|i+e[2],e[3]=0|j+e[3]}function c(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a.charCodeAt(b)+(a.charCodeAt(b+1)<<8)+(a.charCodeAt(b+2)<<16)+(a.charCodeAt(b+3)<<24);return c}function d(b){var a,c=[];for(a=0;64>a;a+=4)c[a>>2]=b[a]+(b[a+1]<<8)+(b[a+2]<<16)+(b[a+3]<<24);return c}function e(a){var d,e,f,g,h,j,k=a.length,l=[1732584193,-271733879,-1732584194,271733878];for(d=64;d<=k;d+=64)b(l,c(a.substring(d-64,d)));for(a=a.substring(d-64),e=a.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=0;d>2]|=a.charCodeAt(d)<<(d%4<<3);if(f[d>>2]|=128<<(d%4<<3),55d;d+=1)f[d]=0;return g=8*k,g=g.toString(16).match(/(.*?)(.{0,8})$/),h=parseInt(g[2],16),j=parseInt(g[1],16)||0,f[14]=h,f[15]=j,b(l,f),l}function f(c){var e,f,g,h,j,k,l=c.length,m=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=l;e+=64)b(m,d(c.subarray(e-64,e)));for(c=e-64>2]|=c[e]<<(e%4<<3);if(g[e>>2]|=128<<(e%4<<3),55e;e+=1)g[e]=0;return h=8*l,h=h.toString(16).match(/(.*?)(.{0,8})$/),j=parseInt(h[2],16),k=parseInt(h[1],16)||0,g[14]=j,g[15]=k,b(m,g),m}function g(a){var b,c="";for(b=0;4>b;b+=1)c+=o[15&a>>8*b+4]+o[15&a>>8*b];return c}function h(a){var b;for(b=0;ba?lc(a+b,0):mc(a,b)}ArrayBuffer.prototype.slice=function(c,d){var e,f,g,h,i=this.byteLength,j=b(c,i),k=i;return(d!==a&&(k=b(d,i)),j>k)?new ArrayBuffer(0):(e=k-j,f=new ArrayBuffer(e),g=new Uint8Array(f),h=new Uint8Array(this,j,e),g.set(h),f)}}(),n.prototype.append=function(a){return this.appendBinary(i(a)),this},n.prototype.appendBinary=function(a){this._buff+=a,this._length+=a.length;var d,e=this._buff.length;for(d=64;d<=e;d+=64)b(this._hash,c(this._buff.substring(d-64,d)));return this._buff=this._buff.substring(d-64),this},n.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(b=0;b>2]|=d.charCodeAt(b)<<(b%4<<3);return this._finish(f,e),c=h(this._hash),a&&(c=m(c)),this.reset(),c},n.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},n.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},n.prototype.setState=function(a){return this._buff=a.buff,this._length=a.length,this._hash=a.hash,this},n.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},n.prototype._finish=function(a,c){var d,e,f,g=c;if(a[g>>2]|=128<<(g%4<<3),55g;g+=1)a[g]=0;d=8*this._length,d=d.toString(16).match(/(.*?)(.{0,8})$/),e=parseInt(d[2],16),f=parseInt(d[1],16)||0,a[14]=e,a[15]=f,b(this._hash,a)},n.hash=function(a,b){return n.hashBinary(i(a),b)},n.hashBinary=function(a,b){var c=e(a),d=h(c);return b?m(d):d},n.ArrayBuffer=function(){this.reset()},n.ArrayBuffer.prototype.append=function(a){var c,e=l(this._buff.buffer,a,!0),f=e.length;for(this._length+=a.byteLength,c=64;c<=f;c+=64)b(this._hash,d(e.subarray(c-64,c)));return this._buff=c-64>2]|=d[b]<<(b%4<<3);return this._finish(f,e),c=h(this._hash),a&&(c=m(c)),this.reset(),c},n.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},n.ArrayBuffer.prototype.getState=function(){var a=n.prototype.getState.call(this);return a.buff=k(a.buff),a},n.ArrayBuffer.prototype.setState=function(a){return a.buff=j(a.buff,!0),n.prototype.setState.call(this,a)},n.ArrayBuffer.prototype.destroy=n.prototype.destroy,n.ArrayBuffer.prototype._finish=n.prototype._finish,n.ArrayBuffer.hash=function(a,b){var c=f(new Uint8Array(a)),d=h(c);return b?m(d):d},n})}),Ee=.7,Fe=1/Ee,Ge="\\s*([+-]?\\d+)\\s*",He="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ie="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Je=/^#([0-9a-f]{3,8})$/,Ke=new RegExp("^rgb\\(".concat(Ge,",").concat(Ge,",").concat(Ge,"\\)$")),Le=new RegExp("^rgb\\(".concat(Ie,",").concat(Ie,",").concat(Ie,"\\)$")),Me=new RegExp("^rgba\\(".concat(Ge,",").concat(Ge,",").concat(Ge,",").concat(He,"\\)$")),Ne=new RegExp("^rgba\\(".concat(Ie,",").concat(Ie,",").concat(Ie,",").concat(He,"\\)$")),Oe=new RegExp("^hsl\\(".concat(He,",").concat(Ie,",").concat(Ie,"\\)$")),Pe=new RegExp("^hsla\\(".concat(He,",").concat(Ie,",").concat(Ie,",").concat(He,"\\)$")),Qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ob(qb,tb,{copy(a){return Object.assign(new this.constructor,this,a)},displayable(){return this.rgb().displayable()},hex:rb,formatHex:rb,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Fb(this).formatHsl()},formatRgb:sb,toString:sb}),ob(yb,xb,pb(qb,{brighter(a){return a=null==a?Fe:jc(Fe,a),new yb(this.r*a,this.g*a,this.b*a,this.opacity)},darker(a){return a=null==a?Ee:jc(Ee,a),new yb(this.r*a,this.g*a,this.b*a,this.opacity)},rgb(){return this},clamp(){return new yb(Cb(this.r),Cb(this.g),Cb(this.b),Bb(this.opacity))},displayable(){return-.5<=this.r&&255.5>this.r&&-.5<=this.g&&255.5>this.g&&-.5<=this.b&&255.5>this.b&&0<=this.opacity&&1>=this.opacity},hex:zb,formatHex:zb,formatHex8:function(){return"#".concat(Db(this.r)).concat(Db(this.g)).concat(Db(this.b)).concat(Db(255*(isNaN(this.opacity)?1:this.opacity)))},formatRgb:Ab,toString:Ab})),ob(Gb,function(a,b,c,d){return 1===arguments.length?Fb(a):new Gb(a,b,c,null==d?1:d)},pb(qb,{brighter(a){return a=null==a?Fe:jc(Fe,a),new Gb(this.h,this.s,this.l*a,this.opacity)},darker(a){return a=null==a?Ee:jc(Ee,a),new Gb(this.h,this.s,this.l*a,this.opacity)},rgb(){var a=this.h%360+360*(0>this.h),b=isNaN(a)||isNaN(this.s)?0:this.s,c=this.l,d=c+(.5>c?c:1-c)*b,e=2*c-d;return new yb(Jb(240<=a?a-240:a+120,e,d),Jb(a,e,d),Jb(120>a?a+240:a-120,e,d),this.opacity)},clamp(){return new Gb(Hb(this.h),Ib(this.s),Ib(this.l),Bb(this.opacity))},displayable(){return(0<=this.s&&1>=this.s||isNaN(this.s))&&0<=this.l&&1>=this.l&&0<=this.opacity&&1>=this.opacity},formatHsl(){var b=Bb(this.opacity);return"".concat(1===b?"hsl(":"hsla(").concat(Hb(this.h),", ").concat(100*Ib(this.s),"%, ").concat(100*Ib(this.l),"%").concat(1===b?")":", ".concat(b,")"))}}));var Re=bc/180,Se=180/bc,Te=18,Ue=.96422,Ve=.82521,We=4/29,Xe=6/29,Ye=3*Xe*Xe,Ze=Xe*Xe*Xe;ob(Lb,function(c,d,a,b){return 1===arguments.length?Kb(c):new Lb(c,d,a,null==b?1:b)},pb(qb,{brighter(a){return new Lb(this.l+Te*(null==a?1:a),this.a,this.b,this.opacity)},darker(a){return new Lb(this.l-Te*(null==a?1:a),this.a,this.b,this.opacity)},rgb(){var a=(this.l+16)/116,b=isNaN(this.a)?a:a+this.a/500,c=isNaN(this.b)?a:a-this.b/200;return b=Ue*Nb(b),a=1*Nb(a),c=Ve*Nb(c),new yb(Ob(3.1338561*b-1.6168667*a-.4906146*c),Ob(-.9787684*b+1.9161415*a+.033454*c),Ob(.0719453*b-.2289914*a+1.4052427*c),this.opacity)}})),ob(Rb,function(a,b,c,d){return 1===arguments.length?Qb(a):new Rb(a,b,c,null==d?1:d)},pb(qb,{brighter(a){return new Rb(this.h,this.c,this.l+Te*(null==a?1:a),this.opacity)},darker(a){return new Rb(this.h,this.c,this.l-Te*(null==a?1:a),this.opacity)},rgb(){return Sb(this).rgb()}}));var $e=-.14861,_e=+1.78277,af=-.29227,bf=-.90649,cf=+1.97294,df=cf*bf,ef=cf*_e,ff=_e*af-bf*$e;ob(Ub,function(a,b,c,d){return 1===arguments.length?Tb(a):new Ub(a,b,c,null==d?1:d)},pb(qb,{brighter(a){return a=null==a?Fe:jc(Fe,a),new Ub(this.h,this.s,this.l*a,this.opacity)},darker(a){return a=null==a?Ee:jc(Ee,a),new Ub(this.h,this.s,this.l*a,this.opacity)},rgb(){var b=isNaN(this.h)?0:(this.h+120)*Re,c=+this.l,d=isNaN(this.s)?0:this.s*c*(1-c),a=gc(b),e=fc(b);return new yb(255*(c+d*($e*a+_e*e)),255*(c+d*(af*a+bf*e)),255*(c+d*(cf*a)),this.opacity)}}));var gf=a=>()=>a,hf=function a(b){function c(a,c){var e=d((a=xb(a)).r,(c=xb(c)).r),f=d(a.g,c.g),g=d(a.b,c.b),b=Yb(a.opacity,c.opacity);return function(c){return a.r=e(c),a.g=f(c),a.b=g(c),a.opacity=b(c),a+""}}var d=Xb(b);return c.gamma=a,c}(1),jf="https://github.com/kalkih/mini-graph-card/blob/master/README.md",kf=14,lf=96,mf={humidity:"hass:water-percent",illuminance:"hass:brightness-5",temperature:"hass:thermometer",battery:"hass:battery",pressure:"hass:gauge",power:"hass:flash",signal_strength:"hass:wifi",motion:"hass:walk",door:"hass:door-closed",window:"hass:window-closed",presence:"hass:account",light:"hass:lightbulb"},nf=["var(--accent-color)","#3498db","#e74c3c","#9b59b6","#f1c40f","#2ecc71","#1abc9c","#34495e","#e67e22","#7f8c8d","#27ae60","#2980b9","#8e44ad"],of=["entity","line","length","fill","points","tooltip","abs","config"],pf={name:!0,icon:!0,state:!0,graph:"line",labels:"hover",labels_secondary:"hover",extrema:!1,legend:!0,fill:!0,points:"hover"},qf=0,rf=1,sf=2,tf=3600000;class uf{constructor(a,b,c){var d=3this._reducer(a,b),[]),c=ac(this.hours*this.points);b.length=c,this.coords=this._calcPoints(b),this.min=mc.apply(Math,Da(this.coords.map(a=>+a[sf]))),this.max=lc.apply(Math,Da(this.coords.map(a=>+a[sf])))}}_reducer(a,b){var c=this._endTime-new Date(b.last_changed).getTime(),d=c/tf*this.points-this.hours*this.points;if(0>d){var e=dc(ec(d));a[e]||(a[e]=[]),a[e].push(b)}else a[0]=[b];return a}_calcPoints(a){var b=this.width/(this.hours*this.points-1);b=Number.isFinite(b)?b:this.width;for(var c,d=[],e=a.filter(Boolean)[0],f=0;f{var b=this._logarithmic?_b(lc(1,a[sf])):a[sf],e=this.height-(b-c)/d+2*this.margin[rf];return[a[qf],e,a[sf]]});return e}getPoints(){var{coords:a}=this;if(1===a.length&&(a[1]=[this.width+this.margin[qf],0,a[0][sf]]),a=this._calcY(this.coords),this._smoothing){var b=a[0];return a.shift(),a.map((a,c)=>{var d=this._midPoint(b[qf],b[rf],a[qf],a[rf]),e=(b[sf]+a[sf])/2;return b=a,[d[qf],d[rf],e,c+1]})}return a.map((a,b)=>[a[qf],a[rf],a[sf],b])}getPath(){var{coords:a}=this;1===a.length&&(a[1]=[this.width+this.margin[qf],0,a[0][sf]]),a=this._calcY(this.coords);var b,c,d="",e=a[0];return d+="M".concat(e[qf],",").concat(e[rf]),a.forEach(a=>{b=a,c=this._smoothing?this._midPoint(e[qf],e[rf],b[qf],b[rf]):b,d+=" ".concat(c[qf],",").concat(c[rf]),d+=" Q ".concat(b[qf],",").concat(b[rf]),e=b}),d+=" ".concat(b[qf],",").concat(b[rf]),d}computeGradient(a,b){var c=b?_b(lc(1,this._max))-_b(lc(1,this._min)):this._max-this._min;return a.map((a,d,e)=>{var f;if(a.value>this._max&&e[d+1]){var h=(this._max-e[d+1].value)/(a.value-e[d+1].value);f=hf(e[d+1].color,a.color)(h)}else if(a.value=c?0:b?(_b(lc(1,this._max))-_b(lc(1,a.value)))*(100/c):(this._max-a.value)*(100/c),{color:f||a.color,offset:g}})}getFill(a){var b=this.height+4*this.margin[rf],c=a;return c+=" L ".concat(this.width-2*this.margin[qf],", ").concat(b),c+=" L ".concat(this.coords[0][qf],", ").concat(b," z"),c}getBars(a,b){var c=2({x:e*f*b+e*a+c,y:d[rf],height:this.height-d[rf]+4*this.margin[rf],width:e-c,value:d[sf]}))}_midPoint(a,b,c,d){return[(a-c)/2+c,(b-d)/2+d]}_average(a){return a.reduce((a,b)=>a+parseFloat(b.state),0)/a.length}_median(a){var b=Da(a).sort((c,a)=>parseFloat(c)-parseFloat(a)),c=dc((b.length-1)/2);return 1==b.length%2?parseFloat(b[c].state):(parseFloat(b[c].state)+parseFloat(b[c+1].state))/2}_maximum(a){return lc.apply(Math,Da(a.map(a=>a.state)))}_minimum(a){return mc.apply(Math,Da(a.map(a=>a.state)))}_first(a){return parseFloat(a[0].state)}_last(a){return parseFloat(a[a.length-1].state)}_sum(a){return a.reduce((a,b)=>a+parseFloat(b.state),0)}_delta(a){return this._maximum(a)-this._minimum(a)}_diff(a){return this._last(a)-this._first(a)}_lastValue(a){return["delta","diff"].includes(this.aggregateFuncName)?0:parseFloat(a[a.length-1].state)||0}_updateEndTime(){switch(this._endTime=new Date,this._groupBy){case"month":this._endTime.setMonth(this._endTime.getMonth()+1),this._endTime.setDate(1);break;case"date":this._endTime.setDate(this._endTime.getDate()+1),this._endTime.setHours(0,0,0,0);break;case"hour":this._endTime.setHours(this._endTime.getHours()+1),this._endTime.setMinutes(0,0,0);}}}var vf=wd(za()),wf=(a,b,c,d,f)=>{var g;switch(d.action){case"more-info":{g=new Event("hass-more-info",{composed:!0}),g.detail={entityId:f},a.dispatchEvent(g);break}case"navigate":{if(!d.navigation_path)return;window.history.pushState(null,"",d.navigation_path),g=new Event("location-changed",{composed:!0}),g.detail={replace:!1},window.dispatchEvent(g);break}case"call-service":{if(!d.service)return;var[h,i]=d.service.split(".",2),j=xa({},d.service_data);b.callService(h,i,j);break}case"url":{if(!d.url)return;window.location.href=d.url;break}case"fire-dom-event":{g=new Event("ll-custom",{composed:!0,bubbles:!0}),g.detail=d,a.dispatchEvent(g);break}}},xf=cc,yf=a=>zf(a,16,function(b){return xf(b)}),zf=(a,b,c)=>{if(null==a)return"";var d,e,f,g={},h={},j="",k="",l="",m=2,n=3,o=2,p=[],q=0,r=0;for(f=0;fl.charCodeAt(0)){for(d=0;dd;d++)q=q<<1|1&e,r==b-1?(r=0,p.push(c(q)),q=0):r++,e>>=1}else{for(e=1,d=0;dd;d++)q=q<<1|1&e,r==b-1?(r=0,p.push(c(q)),q=0):r++,e>>=1}m--,0==m&&(m=jc(2,o),o++),delete h[l]}else for(e=g[l],d=0;d>=1;m--,0==m&&(m=jc(2,o),o++),g[k]=n++,l=j+""}if(""!==l){if(Object.prototype.hasOwnProperty.call(h,l)){if(256>l.charCodeAt(0)){for(d=0;dd;d++)q=q<<1|1&e,r==b-1?(r=0,p.push(c(q)),q=0):r++,e>>=1}else{for(e=1,d=0;dd;d++)q=q<<1|1&e,r==b-1?(r=0,p.push(c(q)),q=0):r++,e>>=1}m--,0==m&&(m=jc(2,o),o++),delete h[l]}else for(e=g[l],d=0;d>=1;m--,0==m&&(m=jc(2,o),o++)}for(e=2,d=0;d>=1;for(;;)if(q<<=1,r==b-1){p.push(c(q));break}else r++;return p.join("")},Af=a=>null==a?"":""==a?null:Bf(a.length,32768,function(b){return a.charCodeAt(b)}),Bf=(a,b,d)=>{var e,f,g,h,j,k,l,m=[],n=4,o=4,p=3,q="",r=[],s={val:d(0),position:b,index:1};for(e=0;3>e;e+=1)m[e]=e;for(g=0,j=jc(2,2),k=1;k!=j;)h=s.val&s.position,s.position>>=1,0==s.position&&(s.position=b,s.val=d(s.index++)),g|=(0>=1,0==s.position&&(s.position=b,s.val=d(s.index++)),g|=(0>=1,0==s.position&&(s.position=b,s.val=d(s.index++)),g|=(0a)return"";for(g=0,j=jc(2,p),k=1;k!=j;)h=s.val&s.position,s.position>>=1,0==s.position&&(s.position=b,s.val=d(s.index++)),g|=(0>=1,0==s.position&&(s.position=b,s.val=d(s.index++)),g|=(0>=1,0==s.position&&(s.position=b,s.val=d(s.index++)),g|=(0a.reduce((a,c)=>+c[b]<+a[b]?c:a,a[0]),Df=(a,b)=>a.reduce((a,c)=>a+ +c[b],0)/a.length,Ef=(a,b)=>a.reduce((a,c)=>+c[b]>+a[b]?c:a,a[0]),Ff=function(a,b){var c=2a*3600*1000,Hf=a=>yf(JSON.stringify(a)),If=a=>"string"==typeof a?JSON.parse(Af(a)):a,Jf=function(){for(var a=arguments.length,b=Array(a),c=0;c"undefined"!=typeof a)},Kf=(c,a)=>c.length===a.length&&c.every((b,c)=>b===a[c]),Lf=a=>{console.warn("mini-graph-card: ",a)},Mf=(a,b)=>{for(var c=b,d=a.length;c{if(!a||!a.length)return a;if(null==a[0].value||null==a[a.length-1].value)throw new Error("The first and last thresholds must have a set \"value\".\n See ".concat(jf));var b=0,c=null;return a.map((d,e)=>{if(null!=d.value)return b=e,xa({},d);null==c?c=Mf(a,e):e>c&&(b=c,c=Mf(a,e));var f=a[b].value,g=a[c].value,h=(g-f)/(c-b);return{color:"string"==typeof d?d:d.color,value:h*e+f}})},Of=(a,b)=>{var c=Nf(a);if(c.sort((c,a)=>a.value-c.value),"smooth"===b)return c;var d,e=(d=[]).concat.apply(d,Da(c.map((a,b)=>[a,{value:a.value-1e-4,color:c[b+1]?c[b+1].color:a.color}])));return e},Pf=a=>{if(!Array.isArray(a.entities))throw new Error("Please provide the \"entities\" option as a list.\n See ".concat(jf));if(a.line_color_above||a.line_color_below)throw new Error("\"line_color_above/line_color_below\" was removed, please use \"color_thresholds\".\n See ".concat(jf));var b=xa(xa({animate:!1,hour24:!1,font_size:kf,font_size_header:14,height:100,hours_to_show:24,points_per_hour:.5,aggregate_func:"avg",group_by:"interval",line_color:[].concat(nf),color_thresholds:[],color_thresholds_transition:"smooth",line_width:5,bar_spacing:4,compress:!0,smoothing:!0,state_map:[],cache:!0,value_factor:0,tap_action:{action:"more-info"},chart_type:"line",zoom_pan_enabled:!1,enable_zoom:!0,enable_pan:!0,show_zoom_controls:!0,micro_interactions:!0,intelligent_cache:!0,performance_mode:!1},JSON.parse(JSON.stringify(a))),{},{show:xa(xa({},pf),a.show)});b.entities.forEach((a,c)=>{"string"==typeof a&&(b.entities[c]={entity:a})}),b.state_map.forEach((a,c)=>{"string"==typeof a&&(b.state_map[c]={value:a,label:a}),b.state_map[c].label=b.state_map[c].label||b.state_map[c].value}),"string"==typeof a.line_color&&(b.line_color=[a.line_color].concat(nf)),b.font_size=a.font_size/100*kf||kf,b.color_thresholds=Of(b.color_thresholds,b.color_thresholds_transition);var c=24lf&&(b.points_per_hour=lf/(b.hours_to_show*e),Lf("Not enough space, adjusting points_per_hour to ".concat(b.points_per_hour)))}return b};class Qf{constructor(a){this.element=a,this.activeInteractions=new Set,this.feedbackQueue=[],this.animationFrameId=null}createPulse(a){var b=1{e.style.transform="scale(1)"},c.duration)}}enhanceDataPointHover(a,b){return{showEffect:()=>{var c=a;c.style.transition="all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",c.style.transform="scale(1.3)",c.style.filter="drop-shadow(0 4px 8px rgba(0,0,0,0.3))";var d="#03a9f4";0b&&(d="#f44336"),c.style.fill=d},hideEffect:()=>{var b=a;b.style.transform="scale(1)",b.style.filter="",b.style.fill=""}}}startPerformanceMonitoring(){var a=()=>{"undefined"!=typeof window&&window.requestAnimationFrame&&(this.animationFrameId=window.requestAnimationFrame(a))};"undefined"!=typeof window&&window.requestAnimationFrame&&(this.animationFrameId=window.requestAnimationFrame(a))}stopPerformanceMonitoring(){this.animationFrameId&&"undefined"!=typeof window&&window.cancelAnimationFrame&&(window.cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}cleanup(){this.activeInteractions.forEach(a=>{"object"==typeof a&&a.stop&&a.stop()}),this.activeInteractions.clear(),this.stopPerformanceMonitoring()}}class Rf{constructor(){var a=0this.cleanup(),300000)}initializeDiskCache(){if(this.config.enableDiskCache)try{"undefined"!=typeof window&&window.localForage&&(this.diskCache=window.localForage.createInstance({name:"mini-graph-cache",version:1,size:this.config.maxDiskSize,storeName:"chart_data"}))}catch(a){console.warn("MGC Cache: Disk cache initialization failed:",a),this.config.enableDiskCache=!1}}generateKey(a,b,c){var d=3this.config.maxMemorySize&&(this.evictLeastRecentlyUsed(),this.memoryCacheSize+b.size>this.config.maxMemorySize))for(var c=.7*this.config.maxMemorySize;this.memoryCacheSize>c&&0{var d=this.accessTimes.get(c)||0;d{var[c,d]=b;a.isValid(d)||(a.memoryCache.delete(c),a.accessTimes.delete(c),a.memoryCacheSize-=d.size)}),a.diskCache&&(yield a.cleanupDiskCache())})()}cleanupDiskCache(){var a=this;return Ca(function*(){if(a.diskCache)try{var b=yield a.diskCache.keys(),c=b.map(b=>a.diskCache.getItem(b).then(c=>a.isValid(c)?null:a.diskCache.removeItem(b)));yield Promise.all(c)}catch(a){console.warn("MGC Cache: Disk cache cleanup failed:",a)}})()}prefetch(a){var b=this;return Ca(function*(){var c=Date.now();[{start:c-21600000,end:c},{start:c-86400000,end:c-21600000}].forEach(c=>{var d=b.generateKey(a,c.start,c.end);b.get(d).catch(()=>{})})})()}updateMetrics(a,b){"hit"===a?this.metrics.hits+=1:"miss"==a&&(this.metrics.misses+=1),this.metrics.averageAccessTime=(this.metrics.averageAccessTime+b)/2}getPerformanceReport(){var a=this.metrics.hits+this.metrics.misses,b=0{b.includes(a)&&c.push(b)}),c.forEach(a=>{var c=b.memoryCache.get(a);b.memoryCache.delete(a),b.accessTimes.delete(a),c&&(b.memoryCacheSize-=c.size)}),b.diskCache)try{var d=yield b.diskCache.keys(),e=d.filter(b=>b.includes(a)),f=e.map(a=>b.diskCache.removeItem(a));yield Promise.all(f)}catch(a){console.warn("MGC Cache: Disk cache invalidation failed:",a)}})()}clear(){var a=this;return Ca(function*(){if(a.memoryCache.clear(),a.accessTimes.clear(),a.memoryCacheSize=0,a.diskCache)try{yield a.diskCache.clear()}catch(a){console.warn("MGC Cache: Disk cache clear failed:",a)}a.metrics={hits:0,misses:0,compressionRatio:0,averageAccessTime:0}})()}destroy(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.memoryCache.clear(),this.accessTimes.clear(),this.memoryCacheSize=0,this.diskCache=null}}var Sf={HISTORICAL_DATA:{ttl:3600000,enableCompression:!0,compressionThreshold:500},REAL_TIME_DATA:{ttl:30000,enableCompression:!1,enableDiskCache:!1},CONFIGURATION_DATA:{ttl:86400000,enableCompression:!0,compressionThreshold:100}},Tf=null;class Uf{constructor(a,b){this.config=a,this.entityData=b,this.chartCache=new Map}renderStackedArea(a,b,c){var{height:d=100}=c,e=this.calculateStackedLayers(a,b);if(!e.length)return $c(va());var f=e.map((a,b)=>{var c=this.getEntityColor(b),e=this.createAreaPath(a.points,d);return $c(ua(),e,c,c,c=>this.handleStackedHover(c,a,b),()=>this.handleStackedOut())});return $c(ta(),f)}renderCandlestick(a,b,c){var{width:d=500,height:e=100}=c,f=lc(2,.8*(d/a.length)),g=a.map((c,g)=>{var h=g*d/a.length+f/2,{open:i,high:j,low:k,close:l}=c,m=e-(i-b[0])/(b[1]-b[0])*e,n=e-(j-b[0])/(b[1]-b[0])*e,o=e-(k-b[0])/(b[1]-b[0])*e,p=e-(l-b[0])/(b[1]-b[0])*e,q=ec(p-m),r=mc(m,p),s=l>i,t=s?"#4caf50":"#f44336",u=s?"#2e7d32":"#c62828";return $c(sa(),g,h,n,h,o,u,h-f/2,r,f,lc(1,q),t,u,a=>this.handleCandleHover(a,c,g),()=>this.handleCandleOut(),h,n,u,h,o,u)});return $c(ra(),g)}renderMultiAxisLines(a,b,c){var{height:d=100}=c,e=[];return a.forEach((a,c)=>{if(a.coords&&a.coords.length){var f=b[c]||[0,1],g=this.getEntityColor(c),h=0==c%2?"left":"right",i=this.createLinePath(a.coords,f,d);e.push($c(qa(),i,g,h,c))}}),$c(pa(),e)}calculateStackedLayers(a,b){if(!a.length)return[];var c=lc.apply(Math,Da(a.map(a=>a.coords&&a.coords.length||0))),d=[],e=Array(c).fill(0);return a.forEach((a,c)=>{if(a.coords){var f=[];a.coords.forEach((a,c)=>{var d=e[c]||0,g=a[2]||0,h=d+g,i=100-100*((h-b[0])/(b[1]-b[0]));f.push([a[0],lc(0,mc(100,i)),g]),e[c]=h}),d.push({entityIndex:c,points:f,entity:a,totalValues:Da(e)})}}),d}createAreaPath(a,b){if(!a.length)return"";var c="",d=a[0],e=500*(d[0]/500);c+="M ".concat(e,",").concat(b),c+=" L ".concat(e,",").concat(d[1]),a.forEach((b,d)=>{var e=500*(d/(a.length-1)),f=b[1];c+=" L ".concat(e,",").concat(f)});var f=a.length-1,g=500*(f/(a.length-1));return c+=" L ".concat(g,",").concat(b),c+=" Z",c}createLinePath(a,b,c){if(!a.length)return"";var d="";return a.forEach((e,f)=>{var g=500*(f/(a.length-1)),h=c-(e[2]-b[0])/(b[1]-b[0])*c,i=lc(0,mc(c,h));d+=0===f?"M ".concat(g,",").concat(i):" L ".concat(g,",").concat(i)}),d}getEntityColor(a){var b=["#03a9f4","#4caf50","#ff9800","#f44336","#9c27b0","#00bcd4","#cddc39","#ff5722"];return this.config.line_color&&this.config.line_color[a]?this.config.line_color[a]:b[a%b.length]}handleStackedHover(a,b,c){var d=a.target;d.style.fillOpacity="0.9",d.style.strokeWidth="2";var e={type:"stacked-area",layer:b,index:c,entity:b.entity};"undefined"!=typeof window&&"undefined"!=typeof window.CustomEvent&&d.dispatchEvent(new window.CustomEvent("chart-hover",{detail:e,bubbles:!0}))}handleStackedOut(){var a=document.querySelectorAll(".stacked-area-layer");a.forEach(a=>{var b=a;b.style.fillOpacity="0.7",b.style.strokeWidth="1"})}handleCandleHover(a,b,c){var d=a.target;d.style.transform="scaleY(1.1)",d.style.filter="brightness(1.1)";"undefined"!=typeof window&&"undefined"!=typeof window.CustomEvent&&d.dispatchEvent(new window.CustomEvent("chart-hover",{detail:{type:"candlestick",candle:b,index:c,ohlc:b},bubbles:!0}))}handleCandleOut(){var a=document.querySelectorAll(".candlestick rect");a.forEach(a=>{var b=a;b.style.transform="scaleY(1)",b.style.filter=""})}getCachedCalculation(a,b){if(this.chartCache.has(a))return this.chartCache.get(a);var c=b();return this.chartCache.set(a,c),setTimeout(()=>{this.chartCache.delete(a)},3e4),c}clearCache(){this.chartCache.clear()}}class Vf{constructor(){var a=0a.preventDefault()))}handleWheel(a){if(this.config.enableZoom){a.preventDefault();var b=this.svgElement.getBoundingClientRect(),c=a.clientX-b.left,d=a.clientY-b.top,e=.001*(-a.deltaY*this.config.zoomSpeed);this.zoomAt(c,d,e)}}handlePointerDown(a){this.config.enablePan&&(a.preventDefault(),this.isDragging=!0,this.lastPointer={x:a.clientX,y:a.clientY},this.svgElement.style.cursor="grabbing")}handlePointerMove(a){if(this.isDragging&&this.config.enablePan){var b=a.clientX-this.lastPointer.x,c=a.clientY-this.lastPointer.y;this.pan(b*this.config.panSpeed,c*this.config.panSpeed),this.lastPointer={x:a.clientX,y:a.clientY}}}handlePointerUp(){this.isDragging=!1,this.svgElement.style.cursor="grab"}handleTouchStart(a){a.preventDefault(),1===a.touches.length&&this.config.touchPan?(this.isDragging=!0,this.isTouch=!0,this.lastPointer={x:a.touches[0].clientX,y:a.touches[0].clientY}):2===a.touches.length&&this.config.touchZoom&&(this.isDragging=!1,this.isTouch=!0,this.touchDistance=this.getTouchDistance(a.touches))}handleTouchMove(a){if(a.preventDefault(),1===a.touches.length&&this.isDragging&&this.config.touchPan){var b=a.touches[0].clientX-this.lastPointer.x,c=a.touches[0].clientY-this.lastPointer.y;this.pan(b*this.config.panSpeed,c*this.config.panSpeed),this.lastPointer={x:a.touches[0].clientX,y:a.touches[0].clientY}}else if(2===a.touches.length&&this.config.touchZoom){var d=this.getTouchDistance(a.touches),e=d/this.touchDistance,f=(a.touches[0].clientX+a.touches[1].clientX)/2,g=(a.touches[0].clientY+a.touches[1].clientY)/2,h=this.svgElement.getBoundingClientRect(),i=f-h.left,j=g-h.top;this.zoomAt(i,j,e-1),this.touchDistance=d}}handleTouchEnd(a){0===a.touches.length&&(this.isDragging=!1,this.isTouch=!1)}getTouchDistance(a){var b=a[0].clientX-a[1].clientX,c=a[0].clientY-a[1].clientY;return hc(b*b+c*c)}zoomAt(a,b,c){var d=lc(this.config.minZoom,mc(this.config.maxZoom,this.scale*(1+c)));if(d!==this.scale){var e=this.svgElement.getBoundingClientRect(),f=a/e.width*this.currentViewBox.width+this.currentViewBox.x,g=b/e.height*this.currentViewBox.height+this.currentViewBox.y,h=this.scale/d;this.currentViewBox.width=this.originalViewBox.width*h,this.currentViewBox.height=this.originalViewBox.height*h,this.currentViewBox.x=f-(f-this.currentViewBox.x)*(d/this.scale),this.currentViewBox.y=g-(g-this.currentViewBox.y)*(d/this.scale),this.scale=d,this.updateTransform()}}pan(a,b){var c=this.svgElement.getBoundingClientRect(),d=a/c.width*this.currentViewBox.width,e=b/c.height*this.currentViewBox.height;this.currentViewBox.x-=d,this.currentViewBox.y-=e,this.updateTransform()}updateTransform(){if(this.svgElement){var a=[this.currentViewBox.x,this.currentViewBox.y,this.currentViewBox.width,this.currentViewBox.height].join(" ");if(this.svgElement.setAttribute("viewBox",a),"undefined"!=typeof window&&"undefined"!=typeof window.CustomEvent){var b=new window.CustomEvent("transform",{detail:{scale:this.scale,translateX:this.translateX,translateY:this.translateY,viewBox:this.currentViewBox},bubbles:!0});this.svgElement.dispatchEvent(b)}}}reset(){this.scale=1,this.translateX=0,this.translateY=0,this.currentViewBox=xa({},this.originalViewBox),this.updateTransform()}setZoom(a){var b=1{var c=b.endsWith("-raw")?a:If(a),d=new Date;d.setHours(d.getHours()-c.hours_to_show),(a.version!=="0.21.1"||new Date(c.last_fetched){console.warn("Purging has errored: ",a)}),console.info("%c MINI-GRAPH-CARD %c ".concat("0.21.1"," "),"color: white; background: coral; font-weight: 700;","color: coral; background: white; font-weight: 700;");var Wf={"Mini Graph Card Configuration":"Configuration Mini Graph Card","Complete configuration for all options":"Configuration compl\xE8te pour toutes les options","Basic configuration required for the card":"Configuration de base requise pour la carte","Name, icon, and visual appearance settings":"Nom, ic\xF4ne et param\xE8tres d'apparence visuelle","Graph type, colors, and visual properties":"Type de graphique, couleurs et propri\xE9t\xE9s visuelles","Data aggregation and time configuration":"Agr\xE9gation des donn\xE9es et configuration temporelle","Y-axis bounds and scaling options":"Limites de l'axe Y et options d'\xE9chelle","Color configuration and dynamic thresholds":"Configuration des couleurs et seuils dynamiques","Advanced options and performance settings":"Options avanc\xE9es et param\xE8tres de performance","Per-entity configuration and customization":"Configuration et personnalisation par entit\xE9","Required Settings":"Param\xE8tres requis","Display Options":"Options d'affichage","Graph Settings":"Param\xE8tres du graphique","Data & Time":"Donn\xE9es et temps","Scale & Bounds":"\xC9chelle et limites","Colors & Thresholds":"Couleurs et seuils","Advanced Options":"Options avanc\xE9es","Entity Configuration":"Configuration des entit\xE9s","Primary Entity (will be converted to entities list)":"Entit\xE9 principale (sera convertie en liste d'entit\xE9s)","Entities List":"Liste des entit\xE9s","Card Name":"Nom de la carte",Icon:"Ic\xF4ne","Icon Image URL":"URL de l'image d'ic\xF4ne",Unit:"Unit\xE9","Font Size (%)":"Taille de police (%)","Header Font Size (px)":"Taille de police de l'en-t\xEAte (px)","Header Alignment":"Alignement de l'en-t\xEAte","Icon Alignment":"Alignement de l'ic\xF4ne","State Alignment":"Alignement de l'\xE9tat","Decimal Places":"Nombre de d\xE9cimales","Height (px)":"Hauteur (px)","Line Width":"\xC9paisseur de ligne","Line Colors (comma-separated)":"Couleurs de ligne (s\xE9par\xE9es par des virgules)","Bar Spacing":"Espacement des barres","Enable Animation":"Activer l'animation","Smooth Lines":"Lignes liss\xE9es","Logarithmic Scale":"\xC9chelle logarithmique","Hours to Show":"Heures \xE0 afficher","Points per Hour":"Points par heure","Aggregate Function":"Fonction d'agr\xE9gation","Group By":"Grouper par","Update Interval (seconds)":"Intervalle de mise \xE0 jour (secondes)","24-Hour Time Format":"Format 24 heures","Lower Bound (use ~N for soft)":"Limite inf\xE9rieure (utiliser ~N pour souple)","Upper Bound (use ~N for soft)":"Limite sup\xE9rieure (utiliser ~N pour souple)","Minimum Range":"Plage minimale","Threshold Transition":"Transition des seuils","Color Thresholds":"Seuils de couleur","Cache Data":"Cache des donn\xE9es","Compress Data":"Compression des donn\xE9es","Group Entities":"Grouper les entit\xE9s",Default:"Par d\xE9faut",Left:"Gauche",Right:"Droite",Center:"Centre","With State":"Avec l'\xE9tat",Average:"Moyenne",Median:"M\xE9diane",Minimum:"Minimum",Maximum:"Maximum",First:"Premier",Last:"Dernier",Sum:"Somme",Delta:"Delta",Difference:"Diff\xE9rence",Interval:"Intervalle",Date:"Date",Hour:"Heure",Smooth:"Lisse",Hard:"Dur",min:"min",avg:"moy",max:"max","Visibility Options":"Options de visibilit\xE9",Name:"Nom",State:"\xC9tat",Graph:"Graphique",Fill:"Remplissage",Legend:"L\xE9gende",Extrema:"Extrema",Labels:"\xC9tiquettes","Secondary Labels":"\xC9tiquettes secondaires",Points:"Points","Add Entity":"Ajouter une entit\xE9",Remove:"Supprimer","Add Threshold":"Ajouter un seuil","Add State Mapping":"Ajouter un mappage d'\xE9tat","Card title":"Titre de la carte","°C, kW, etc.":"\xB0C, kW, etc.","#ff0000, #00ff00, #0000ff":"#ff0000, #00ff00, #0000ff","0 or ~0":"0 ou ~0","100 or ~100":"100 ou ~100",Value:"Valeur",Color:"Couleur","Original Value":"Valeur originale","Display Label":"Libell\xE9 affich\xE9","Loading Home Assistant...":"Chargement de Home Assistant...","Please wait while the editor loads.":"Veuillez patienter pendant le chargement de l'\xE9diteur.","Editor Error":"Erreur de l'\xE9diteur","An error occurred while rendering the editor:":"Une erreur s'est produite lors du rendu de l'\xE9diteur :","Primary Y-Axis":"Axe Y principal",Thresholds:"Seuils","Custom Name":"Nom personnalis\xE9","Custom Color":"Couleur personnalis\xE9e","Configure individual entity settings. These override global settings for specific entities.":"Configurez les param\xE8tres individuels des entit\xE9s. Ceux-ci remplacent les param\xE8tres globaux pour des entit\xE9s sp\xE9cifiques.",Configure:"Configurer",Hide:"Masquer","Attribute (instead of state)":"Attribut (au lieu de l'\xE9tat)","Y-Axis":"Axe Y",Primary:"Principal",Secondary:"Secondaire","Show State":"Afficher l'\xE9tat","Show in Graph":"Afficher dans le graphique","Show Line":"Afficher la ligne","Show Fill":"Afficher le remplissage","Show Points":"Afficher les points","Show in Legend":"Afficher dans la l\xE9gende",Smoothing:"Lissage","Fixed Value":"Valeur fixe",Entities:"Entit\xE9s","Add, configure and manage all your entities":"Ajoutez, configurez et g\xE9rez toutes vos entit\xE9s","Remove Entity":"Supprimer l'entit\xE9","Tap Action":"Action tactile","Action Type":"Type d'action"},Xf=()=>{var a=navigator.language||navigator.userLanguage||"en";return a.toLowerCase().startsWith("fr")?"fr":"en"},Yf=a=>{var b=Xf();return"fr"===b&&Wf[a]?Wf[a]:a};class Zf extends yd{static get properties(){return{hass:Object,_config:Object,_expandedSections:Object,_expandedEntities:Array}}constructor(){super(),this._expandedSections={required:!0,display:!1,graph:!1,data:!1,bounds:!1,colors:!1,advanced:!1,entities:!1},this._expandedEntities=[]}setConfig(a){this._config=xa({},a),this._config.entities&&(this._config.entities=this._config.entities.map(a=>"string"==typeof a?{entity:a}:xa({},a))),this.requestUpdate()}get _entity(){var a=this._config&&this._config.entity||"";return a}get _entities(){var a=this._config&&this._config.entities||[];return a}get _name(){var a=this._config&&this._config.name||"";return a}get _icon(){var a=this._config&&this._config.icon||"";return a}get _icon_image(){var a=this._config&&this._config.icon_image||"";return a}get _unit(){var a=this._config&&this._config.unit||"";return a}get _height(){var a=this._config&&this._config.height||100;return a}get _line_width(){var a=this._config&&this._config.line_width||5;return a}get _line_color(){var a=Array.isArray(this._config&&this._config.line_color)?this._config.line_color.join(", "):this._config&&this._config.line_color||"";return a}get _bar_spacing(){var a=this._config&&this._config.bar_spacing||4;return a}get _animate(){var a=!this._config||!1!==this._config.animate;return a}get _hours_to_show(){var a=this._config&&this._config.hours_to_show||24;return a}get _points_per_hour(){var a=this._config&&this._config.points_per_hour||.5;return a}get _aggregate_func(){var a=this._config&&this._config.aggregate_func||"avg";return a}get _group_by(){var a=this._config&&this._config.group_by||"interval";return a}get _update_interval(){var a=this._config&&this._config.update_interval||"";return a}get _hour24(){var a=this._config&&this._config.hour24||!1;return a}get _lower_bound(){var a=this._config&&this._config.lower_bound!==void 0?this._config.lower_bound:"";return a}get _upper_bound(){var a=this._config&&this._config.upper_bound!==void 0?this._config.upper_bound:"";return a}get _min_bound_range(){var a=this._config&&this._config.min_bound_range||"";return a}get _smoothing(){var a=!this._config||!1!==this._config.smoothing;return a}get _logarithmic(){var a=this._config&&this._config.logarithmic||!1;return a}get _color_thresholds(){var a=this._config&&this._config.color_thresholds||[];return a}get _color_thresholds_transition(){var a=this._config&&this._config.color_thresholds_transition||"smooth";return a}get _font_size(){var a=this._config&&this._config.font_size||100;return a}get _font_size_header(){var a=this._config&&this._config.font_size_header||14;return a}get _align_header(){var a=this._config&&this._config.align_header||"default";return a}get _align_icon(){var a=this._config&&this._config.align_icon||"right";return a}get _align_state(){var a=this._config&&this._config.align_state||"left";return a}get _decimals(){var a=this._config&&this._config.decimals!==void 0?this._config.decimals:"";return a}get _cache(){var a=!this._config||!1!==this._config.cache;return a}get _compress(){var a=!this._config||!1!==this._config.compress;return a}get _group(){var a=this._config&&this._config.group||!1;return a}get _show(){var a=this._config&&this._config.show||{};return a}get _tap_action(){var a=this._config&&this._config.tap_action||{action:"more-info"};return a}render(){if(!this.hass)return Zc(oa(),Yf("Loading Home Assistant..."),Yf("Please wait while the editor loads."));try{return Zc(na(),Yf("Mini Graph Card Configuration"),Yf("Complete configuration for all options"),this.renderSection("entities","\uD83C\uDFE0 ".concat(Yf("Entities")),Yf("Add, configure and manage all your entities"),Zc(ma(),0===this._entities.length?Zc(la(),Yf("Primary Entity (will be converted to entities list)"),this.renderEntityPicker(this._entity,a=>this._primaryEntityChanged(a))):"",this._entities.map((a,b)=>Zc(ka(),this.renderEntityPicker("string"==typeof a?a:a.entity,a=>this._entityListChanged(a,b)),(()=>{var b="string"==typeof a?a:a.entity,c=this.getEntityInfo(b);return Zc(ja(),c.icon,c.friendlyName,c.entityId)})(),()=>this._toggleEntityConfig(b),this._isEntityConfigExpanded(b)?Yf("Hide"):Yf("Configure"),()=>this._removeEntity(b),Yf("Remove Entity"),this._isEntityConfigExpanded(b)?Zc(ia(),this.renderEntityConfig(a,b)):"")),this._addEntity,Yf("Add Entity"))),this.renderSection("display","\uD83C\uDFA8 ".concat(Yf("Display Options")),Yf("Name, icon, and visual appearance settings"),Zc(ha(),Yf("Card Name"),this._name,a=>this._valueChanged(a,"name"),Yf("Card title"),Yf("Icon"),this.renderIconPicker(this._icon,a=>this._valueChanged(a,"icon")),Yf("Icon Image URL"),this._icon_image,a=>this._valueChanged(a,"icon_image"),Yf("Unit"),this._unit,a=>this._valueChanged(a,"unit"),Yf("\xB0C, kW, etc."),Yf("Font Size (%)"),this._font_size,a=>this._valueChanged(a,"font_size"),Yf("Header Font Size (px)"),this._font_size_header,a=>this._valueChanged(a,"font_size_header"),Yf("Header Alignment"),this._align_header,a=>this._valueChanged(a,"align_header"),Yf("Default"),Yf("Left"),Yf("Right"),Yf("Center"),Yf("Icon Alignment"),this._align_icon,a=>this._valueChanged(a,"align_icon"),Yf("Left"),Yf("Right"),Yf("Center"),Yf("With State"),Yf("State Alignment"),this._align_state,a=>this._valueChanged(a,"align_state"),Yf("Left"),Yf("Right"),Yf("Center"),Yf("Decimal Places"),this._decimals,a=>this._valueChanged(a,"decimals"),Yf("Visibility Options"),[{key:"name",label:Yf("Name")},{key:"icon",label:Yf("Icon")},{key:"state",label:Yf("State")},{key:"graph",label:Yf("Graph")},{key:"fill",label:Yf("Fill")},{key:"points",label:Yf("Points")},{key:"legend",label:Yf("Legend")},{key:"extrema",label:Yf("Extrema")},{key:"average",label:Yf("Average")},{key:"labels",label:Yf("Labels")},{key:"labels_secondary",label:Yf("Secondary Labels")}].map(a=>Zc(ga(),!1!==this._show[a.key],b=>this._showChanged(b,a.key),a.label)))),this.renderSection("graph","\uD83D\uDCCA ".concat(Yf("Graph Settings")),Yf("Graph type, colors, and visual properties"),Zc(fa(),Yf("Height (px)"),this._height,a=>this._valueChanged(a,"height"),Yf("Line Width"),this._line_width,a=>this._valueChanged(a,"line_width"),Yf("Line Colors (comma-separated)"),this._line_color,a=>this._valueChanged(a,"line_color"),Yf("#ff0000, #00ff00, #0000ff"),Yf("Bar Spacing"),this._bar_spacing,a=>this._valueChanged(a,"bar_spacing"),this._animate,a=>this._valueChanged(a,"animate"),Yf("Enable Animation"),this._smoothing,a=>this._valueChanged(a,"smoothing"),Yf("Smooth Lines"),this._logarithmic,a=>this._valueChanged(a,"logarithmic"),Yf("Logarithmic Scale"))),this.renderSection("data","\u23F1\uFE0F ".concat(Yf("Data & Time")),Yf("Data aggregation and time configuration"),Zc(ea(),Yf("Hours to Show"),this._hours_to_show,a=>this._valueChanged(a,"hours_to_show"),Yf("Points per Hour"),this._points_per_hour,a=>this._valueChanged(a,"points_per_hour"),Yf("Aggregate Function"),this._aggregate_func,a=>this._valueChanged(a,"aggregate_func"),Yf("Average"),Yf("Median"),Yf("Minimum"),Yf("Maximum"),Yf("First"),Yf("Last"),Yf("Sum"),Yf("Delta"),Yf("Difference"),Yf("Group By"),this._group_by,a=>this._valueChanged(a,"group_by"),Yf("Interval"),Yf("Date"),Yf("Hour"),Yf("Update Interval (seconds)"),this._update_interval,a=>this._valueChanged(a,"update_interval"),this._hour24,a=>this._valueChanged(a,"hour24"),Yf("24-Hour Time Format"))),this.renderSection("bounds","\uD83D\uDCCF ".concat(Yf("Scale & Bounds")),Yf("Y-axis bounds and scaling options"),Zc(da(),Yf("Primary Y-Axis"),Yf("Lower Bound (use ~N for soft)"),this._lower_bound,a=>this._valueChanged(a,"lower_bound"),Yf("0 or ~0"),Yf("Upper Bound (use ~N for soft)"),this._upper_bound,a=>this._valueChanged(a,"upper_bound"),Yf("100 or ~100"),Yf("Minimum Range"),this._min_bound_range,a=>this._valueChanged(a,"min_bound_range"))),this.renderSection("colors","\uD83C\uDFA8 ".concat(Yf("Colors & Thresholds")),Yf("Color configuration and dynamic thresholds"),Zc(ca(),Yf("Threshold Transition"),this._color_thresholds_transition,a=>this._valueChanged(a,"color_thresholds_transition"),Yf("Smooth"),Yf("Hard"),Yf("Color Thresholds"),this._addThreshold,Yf("Add Threshold"),this._color_thresholds.map((a,b)=>Zc(ba(),a.value,a=>this._thresholdChanged(a,b,"value"),Yf("Value"),a.color,a=>this._thresholdChanged(a,b,"color"),()=>this._removeThreshold(b))))),this.renderSection("advanced","\u2699\uFE0F ".concat(Yf("Advanced Options")),Yf("Advanced options and performance settings"),Zc(aa(),this._cache,a=>this._valueChanged(a,"cache"),Yf("Cache Data"),this._compress,a=>this._valueChanged(a,"compress"),Yf("Compress Data"),this._group,a=>this._valueChanged(a,"group"),Yf("Group Entities"),Yf("Tap Action"),Yf("Action Type"),this._tap_action.action,a=>this._tapActionChanged(a,"action"),"navigate"===this._tap_action.action?Zc(_(),this._tap_action.navigation_path||"",a=>this._tapActionChanged(a,"navigation_path")):"","url"===this._tap_action.action?Zc($(),this._tap_action.url||"",a=>this._tapActionChanged(a,"url")):"","call-service"===this._tap_action.action?Zc(Z(),this._tap_action.service||"",a=>this._tapActionChanged(a,"service")):"")))}catch(a){return Zc(Y(),Yf("Editor Error"),Yf("An error occurred while rendering the editor:"),a.message,a.stack)}}renderSection(a,b,c,d){var e=this._expandedSections[a];return Zc(X(),e?"expanded":"",()=>this._toggleSection(a),b,c,e?"\u25BC":"\u25B6",e?Zc(W(),d):"")}renderEntityPicker(a,b){try{if(this.hass&&customElements.get("ha-entity-picker"))return Zc(V(),this.hass,a,b)}catch(a){}return Zc(U(),a,b,Object.keys(this.hass&&this.hass.states||{}).map(a=>Zc(T(),a)))}renderIconPicker(a,b){try{if(this.hass&&customElements.get("ha-icon-picker"))return Zc(S(),this.hass,a,b)}catch(a){}return Zc(R(),a,b)}renderEntityConfig(a,b){var c="string"==typeof a?{}:a;return Zc(Q(),Yf("Custom Name"),c.name||"",a=>this._entityConfigChanged(a,b,"name"),Yf("Custom Color"),c.color||"#ff0000",a=>this._entityConfigChanged(a,b,"color"),Yf("Attribute (instead of state)"),c.attribute||"",a=>this._entityConfigChanged(a,b,"attribute"),Yf("Y-Axis"),c.y_axis||"primary",a=>this._entityConfigChanged(a,b,"y_axis"),Yf("Primary"),Yf("Secondary"),[{key:"show_state",label:"Show State"},{key:"show_graph",label:"Show in Graph"},{key:"show_line",label:"Show Line"},{key:"show_fill",label:"Show Fill"},{key:"show_points",label:"Show Points"},{key:"show_legend",label:"Show in Legend"},{key:"smoothing",label:"Smoothing"},{key:"fixed_value",label:"Fixed Value"}].map(a=>Zc(P(),!1!==c[a.key],c=>this._entityConfigChanged(c,b,a.key),Yf(a.label))))}getEntityInfo(a){if(!this.hass||!this.hass.states)return{entityId:a,friendlyName:a,icon:"mdi:help-circle",domain:a.split(".")[0]||"unknown"};var b=this.hass.states[a];return b?{entityId:a,friendlyName:b.attributes.friendly_name||a,icon:b.attributes.icon||this.getDefaultIcon(a),domain:a.split(".")[0]||"unknown",state:b.state}:{entityId:a,friendlyName:a,icon:"mdi:help-circle-outline",domain:a.split(".")[0]||"unknown"}}getDefaultIcon(a){var b=a.split(".")[0];return{sensor:"mdi:gauge",binary_sensor:"mdi:radiobox-blank",switch:"mdi:toggle-switch",light:"mdi:lightbulb",climate:"mdi:thermostat",cover:"mdi:window-shutter",fan:"mdi:fan",lock:"mdi:lock",camera:"mdi:camera",media_player:"mdi:cast",device_tracker:"mdi:account",sun:"mdi:white-balance-sunny",weather:"mdi:weather-partly-cloudy"}[b]||"mdi:help-circle"}_toggleSection(a){this._expandedSections=xa(xa({},this._expandedSections),{},{[a]:!this._expandedSections[a]}),this.requestUpdate()}_primaryEntityChanged(a){var b=a.detail&&a.detail.value||a.target&&a.target.value;b&&!this._entities.length&&(this._config=xa(xa({},this._config),{},{entities:[b]}),delete this._config.entity,ye(this,"config-changed",{config:this._config}))}_addEntity(){var a=[].concat(Da(this._entities),[""]);this._config=xa(xa({},this._config),{},{entities:a}),ye(this,"config-changed",{config:this._config})}_removeEntity(a){var b=Da(this._entities);b.splice(a,1),this._config=xa(xa({},this._config),{},{entities:b}),ye(this,"config-changed",{config:this._config})}_entityListChanged(a,b){var c=a.detail&&a.detail.value||a.target&&a.target.value;if(c){var d=Da(this._entities);d[b]=c,this._config=xa(xa({},this._config),{},{entities:d}),ye(this,"config-changed",{config:this._config})}}_valueChanged(a,b){if(this._config&&this.hass){var c;c="checkbox"===a.target.type?a.target.checked:"number"===a.target.type?+a.target.value||0:a.detail&&void 0!==a.detail.value?a.detail.value:a.target.value,"line_color"===b&&"string"==typeof c&&c.includes(",")&&(c=c.split(",").map(a=>a.trim())),this._config=xa(xa({},this._config),{},{[b]:c}),ye(this,"config-changed",{config:this._config})}}_showChanged(a,b){if(this._config&&this.hass){var c=a.target.checked;this._config=xa(xa({},this._config),{},{show:xa(xa({},this._show),{},{[b]:c})}),ye(this,"config-changed",{config:this._config})}}_addThreshold(){var a=[].concat(Da(this._color_thresholds),[{value:0,color:"#ff0000"}]);this._config=xa(xa({},this._config),{},{color_thresholds:a}),ye(this,"config-changed",{config:this._config})}_removeThreshold(a){var b=Da(this._color_thresholds);b.splice(a,1),this._config=xa(xa({},this._config),{},{color_thresholds:b}),ye(this,"config-changed",{config:this._config})}_thresholdChanged(a,b,c){var d=Da(this._color_thresholds),{value:e}=a.target;"value"===c&&(e=+e),d[b]=xa(xa({},d[b]),{},{[c]:e}),this._config=xa(xa({},this._config),{},{color_thresholds:d}),ye(this,"config-changed",{config:this._config})}_tapActionChanged(a,b){var{value:c}=a.target,d=xa(xa({},this._tap_action),{},{[b]:c});this._config=xa(xa({},this._config),{},{tap_action:d}),ye(this,"config-changed",{config:this._config})}_toggleEntityConfig(a){this._expandedEntities=this._expandedEntities||[];var b=this._expandedEntities.includes(a);this._expandedEntities=b?this._expandedEntities.filter(b=>b!==a):[].concat(Da(this._expandedEntities),[a]),this.requestUpdate()}_isEntityConfigExpanded(a){return this._expandedEntities&&this._expandedEntities.includes(a)}_entityConfigChanged(a,b,c){var d=Da(this._entities),e="string"==typeof d[b]?{entity:d[b]}:xa({},d[b]),{value:f}=a.target;"checkbox"===a.target.type&&(f=a.target.checked),e[c]=f,d[b]=e,this._config=xa(xa({},this._config),{},{entities:d}),ye(this,"config-changed",{config:this._config})}static get styles(){return wd(O())}}customElements.define("mini-graph-card-editor",Zf);var $f={min:"min",avg:"moy",max:"max"},_f=(a,b)=>{var c=b||navigator.language||navigator.userLanguage||"en";return c.toLowerCase().startsWith("fr")&&$f[a]?$f[a]:a};class ag extends yd{constructor(){super(),this.id=Math.random().toString(36).substr(2,9),this.config={},this.bound=[0,0],this.boundSecondary=[0,0],this.length=[],this.entity=[],this.line=[],this.bar=[],this.abs=[],this.fill=[],this.points=[],this.gradient=[],this.tooltip={},this.updateQueue=[],this.updating=!1,this.stateChanged=!1,this.initial=!0,this._md5Config=void 0,this.microInteractions=null,this.activeTooltip=null,this.advancedCharts=null,this.zoomPanController=null,this.cache=null}static get styles(){return vf}set hass(a){this._hass=a;var b=!1,c=[];this.config.entities.forEach((d,e)=>{this.config.entities[e].index=e;var f=a&&a.states[d.entity]||void 0;f&&this.entity[e]!==f&&(this.entity[e]=f,c.push("".concat(f.entity_id,"-").concat(e)),b=!0)}),b&&(this.stateChanged=!0,this.entity=Da(this.entity),this.config.update_interval||this.updating?this.updateQueue=[].concat(c,Da(this.updateQueue)):setTimeout(()=>{this.updateQueue=[].concat(c,Da(this.updateQueue)),this.updateData()},this.initial?0:1e3))}static get properties(){return{id:String,_hass:{},config:{},entity:[],Graph:[],line:[],shadow:[],length:Number,bound:[],boundSecondary:[],abs:[],tooltip:{},updateQueue:[],color:String}}setConfig(a){this.config=Pf(a,this.config),this._md5Config=De.hash(JSON.stringify(this.config));var b=!Kf(this.config.entities||[],a.entities);(!this.Graph||b)&&(this._hass&&(this.hass=this._hass),this.Graph=this.config.entities.map(a=>new uf(500,this.config.height,[this.config.show.fill?0:this.config.line_width,this.config.line_width],this.config.hours_to_show,this.config.points_per_hour,a.aggregate_func||this.config.aggregate_func,this.config.group_by,Jf(a.smoothing,this.config.smoothing,!a.entity.startsWith("binary_sensor.")),this.config.logarithmic)))}connectedCallback(){super.connectedCallback(),this.microInteractions||(this.microInteractions=new Qf(this)),this.advancedCharts||(this.advancedCharts=new Uf(this.config,this.entity)),this.cache||(this.cache=Zb({maxMemorySize:26214400,enableCompression:!0,enableDiskCache:!0})),this.config.update_interval&&(window.requestAnimationFrame(()=>{this.updateOnInterval()}),this.interval=setInterval(()=>this.updateOnInterval(),1e3*this.config.update_interval))}disconnectedCallback(){this.interval&&clearInterval(this.interval),this.microInteractions&&(this.microInteractions.cleanup(),this.microInteractions=null),this.advancedCharts&&(this.advancedCharts.clearCache(),this.advancedCharts=null),this.zoomPanController&&(this.zoomPanController.destroy(),this.zoomPanController=null),super.disconnectedCallback()}shouldUpdate(a){if(of.some(b=>a.has(b)))return this.color=this.computeColor(void 0===this.tooltip.value?this.getEntityState(0):this.tooltip.value,this.tooltip.entity||0),!0}firstUpdated(){this.initial=!1,this.config.zoom_pan_enabled&&!this.zoomPanController&&setTimeout(()=>{var a=this.shadowRoot.querySelector("svg");a&&(this.zoomPanController=new Vf({enableZoom:!1!==this.config.enable_zoom,enablePan:!1!==this.config.enable_pan,minZoom:this.config.min_zoom||.1,maxZoom:this.config.max_zoom||10}),this.zoomPanController.initialize(a,{x:0,y:0,width:500,height:this.config.height}))},100)}updated(a){this.config.animate&&a.has("line")&&(this.length.length{this.length[a.id]=a.getTotalLength()}),this.length=Da(this.length)):this.length=Array(this.entity.length).fill("none"))}render(){var{config:a}=0void 0===this.entity[b])?this.renderWarnings():Zc(M(),a.group,a.show.graph&&a.show.fill,"hover"===a.show.points,"hover"===a.show.labels,"hover"===a.show.labels_secondary,0this.handlePopup(b,a.tap_action.entity||this.entity[0]),this.renderHeader(),this.renderStates(),this.renderGraph(),this.renderInfo()):Zc(N())}renderWarnings(){return Zc(L(),this.config.entities.map((a,b)=>this.entity[b]?Zc(J()):Zc(K(),this.config.entities[b].entity)))}renderHeader(){var{show:a,align_icon:b,align_header:c,font_size_header:d}=this.config;return a.name||a.icon&&"state"!==b?Zc(I(),c,d,this.renderName(),"state"===b?"":this.renderIcon()):""}renderIcon(){if(this.config.icon_image!==void 0)return Zc(H(),this.config.icon_image);var{icon:a,icon_adaptive_color:b}=this.config.show;return a?Zc(G(),this.config.align_icon,b?"color: ".concat(this.color,";"):"",this.computeIcon(this.entity[0])):""}renderName(){if(this.config.show.name){var a=void 0===this.tooltip.entity?this.config.name||this.computeName(0):this.computeName(this.tooltip.entity),b=this.config.show.name_adaptive_color?"opacity: 1; color: ".concat(this.color,";"):"";return Zc(F(),b,a)}}renderStates(){if(this.config.show.state)return Zc(E(),this.config.align_state,this.renderState(0),this.config.entities.map((a,b)=>0a&&a[b],a)}getEntityState(a){var b=this.config.entities[a];return"last"===this.config.show.state?this.points[a][this.points[a].length-1][sf]:b.attribute?this.getObjectAttr(this.entity[a].attributes,b.attribute):this.entity[a].state}renderState(a){var b=0===a;if(b||this.config.entities[a].show_state){var c=this.getEntityState(a),{entity:d,value:e}=this.tooltip,f=b&&d!==void 0,g=f?e:c,h=f?d:a,i=this.config.entities[h];return Zc(D(),!b&&"state--small",b=>this.handlePopup(b,this.entity[a]),i.state_adaptive_color?"color: ".concat(this.computeColor(g,h)):"",i.show_indicator?this.renderIndicator(g,h):"",this.computeState(g),this.computeUom(h),b&&this.renderStateTime()||"")}}renderStateTime(){return void 0===this.tooltip.value?void 0:Zc(C(),this.tooltip.label?Zc(B(),this.tooltip.label):Zc(A(),this.tooltip.time[0],this.tooltip.time[1]))}renderGraph(){var a=this.entity[0]&&!this.Graph.some((a,b)=>a._history===void 0&&!1!==this.config.entities[b].show_graph)||!1===this.config.show.loading_indicator;return this.config.show.graph?Zc(z(),a?Zc(y(),this.renderLabels(),this.renderLabelsSecondary(),this.renderSvg(),this.renderLegend()):Zc(x())):""}computeLegend(a){var b=this.computeName(a),c=this.getEntityState(a),{show_legend_state:d=!1}=this.config.entities[a];if(d){if(b+=" (".concat(this.computeState(c)),!["unavailable"].includes(c)){var e=this.computeUom(a);["%",""].includes(e)||(b+=" "),b+="".concat(e)}b+=")"}return b}renderLegend(){return 1>=this.visibleLegends.length||!this.config.show.legend?void 0:Zc(w(),this.visibleLegends.map(a=>{var b=this.computeLegend(a.index);return Zc(v(),b=>this.handlePopup(b,this.entity[a.index]),()=>this.setTooltip(a.index,-1,this.getEntityState(a.index),"Current"),()=>this.tooltip={},this.renderIndicator(this.getEntityState(a.index),a.index),b)}))}renderIndicator(a,b){return $c(u(),this.computeColor(a,b))}renderSvgFill(a,b){if(a){var c="fade"===this.config.show.fill,d=this.length[b]||!1===this.config.entities[b].show_line;return $c(t(),"fill-grad-".concat(this.id,"-").concat(b),"fill-grad-mask-".concat(this.id,"-").concat(b),"url(#fill-grad-".concat(this.id,"-").concat(b,")"),"fill-".concat(this.id,"-").concat(b),this.config.show.fill,b,this.config.animate,d,this.config.animate?"".concat(.5*b,"s"):"0s",c?"url(#fill-grad-mask-".concat(this.id,"-").concat(b,")"):"",this.fill[b])}}renderSvgLine(a,b){if(a){var c=$c(s(),b,this.config.animate,this.length[b],this.config.animate?"".concat(.5*b,"s"):"0s",this.length[b]||"none",this.length[b]||"none","white",this.config.line_width,this.line[b]);return $c(r(),"line-".concat(this.id,"-").concat(b),c)}}renderSvgPoint(a,b){var c=this.gradient[b]?this.computeColor(a[sf],b):"inherit";return $c(q(),this.tooltip.index!==a[3],"--mcg-hover: ".concat(c,";"),c,c,a[qf],a[rf],this.config.line_width,()=>{this.setTooltip(b,a[3],a[sf])},()=>{this.tooltip={},this.activeTooltip=null},b,a[sf])}renderSvgPoints(a,b){if(a){var c=this.computeColor(this.entity[b].state,b);return $c(p(),this.tooltip.entity===b,void 0!==this.tooltip.entity&&this.tooltip.entity!==b,this.length[b],this.config.animate&&"hover"!==this.config.show.points,this.config.animate?"".concat(.5*b+.5,"s"):"0s",c,c,this.config.line_width/2,a.map(a=>this.renderSvgPoint(a,b)))}}renderSvgGradient(a){if(a){var b=a.map((a,b)=>a?$c(o(),"grad-".concat(this.id,"-").concat(b),a.map(a=>$c(n(),a.color,"".concat(a.offset,"%")))):void 0);return $c(m(),b)}}renderSvgLineRect(a,b){if(a){var c=this.gradient[b]?"url(#grad-".concat(this.id,"-").concat(b,")"):this.computeColor(this.entity[b].state,b);return $c(l(),void 0!==this.tooltip.entity&&this.tooltip.entity!==b,"rect-".concat(this.id,"-").concat(b),c,"url(#line-".concat(this.id,"-").concat(b,")"))}}renderSvgFillRect(a,b){if(a){var c=this.gradient[b]?"url(#grad-".concat(this.id,"-").concat(b,")"):this.computeColor(this.entity[b].state,b);return $c(k(),void 0!==this.tooltip.entity&&this.tooltip.entity!==b,"fill-rect-".concat(this.id,"-").concat(b),c,"url(#fill-".concat(this.id,"-").concat(b,")"))}}renderSvgBars(a,b){if(a){var c=a.map((a,c)=>{var d=this.config.animate?$c(j(),this.config.height,a.y):"",e=this.computeColor(a.value,b);return $c(h(),a.x,a.y,a.height,a.width,e,()=>this.setTooltip(b,c,a.value),()=>this.tooltip={},d)});return $c(g(),this.config.animate,c)}}renderSvg(){var{height:a}=this.config;return $c(f(),0===a?0:"100%",a,a=>a.stopPropagation(),this.renderSvgGradient(this.gradient),this.fill.map((a,b)=>this.renderSvgFill(a,b)),this.fill.map((a,b)=>this.renderSvgFillRect(a,b)),this.line.map((a,b)=>this.renderSvgLine(a,b)),this.line.map((a,b)=>this.renderSvgLineRect(a,b)),this.bar.map((a,b)=>this.renderSvgBars(a,b)),this.points.map((a,b)=>this.renderSvgPoints(a,b)))}setTooltip(a,b,c){var d=3Zc(b(),_f(a.type,this._hass.language),this.computeState(a.state),this.computeUom(0),"avg"===a.type?"":Ff(new Date(a.last_changed),this.config.format,this._hass.language)))):Zc(a())}handlePopup(a,b){a.stopPropagation(),wf(this,this._hass,this.config,this.config.tap_action,b.entity_id||b)}get visibleEntities(){return this.config.entities.filter(a=>!1!==a.show_graph)}get primaryYaxisEntities(){return this.visibleEntities.filter(a=>a.y_axis===void 0||"primary"===a.y_axis)}get secondaryYaxisEntities(){return this.visibleEntities.filter(a=>"secondary"===a.y_axis)}get visibleLegends(){return this.visibleEntities.filter(a=>!1!==a.show_legend)}get primaryYaxisSeries(){return this.primaryYaxisEntities.map(a=>this.Graph[a.index])}get secondaryYaxisSeries(){return this.secondaryYaxisEntities.map(a=>this.Graph[a.index])}computeColor(a,b){var c,{color_thresholds:d,line_color:e}=this.config,f=+a||0;if(0a.valuea.valueb.value===a);if(f)return f.label;"string"==typeof a&&$b(parseFloat(a))&&Lf("value [".concat(a,"] not found in state_map"))}var b="string"==typeof a?parseFloat(a.replace(/,/g,".")):+a;var c=this.config.decimals,d=10**this.config.value_factor;if(c===void 0||$b(c)||$b(b))return this.numberFormat(kc(100*(b*d))/100,this._hass.language);var e=10**c;return this.numberFormat((kc(b*d*e)/e).toFixed(c),this._hass.language,c)}numberFormat(a,b,c){return!$b(+a)&&Intl?new Intl.NumberFormat(b,{minimumFractionDigits:c}).format(+a):a.toString()}updateOnInterval(){this.stateChanged&&!this.updating&&(this.stateChanged=!1,this.updateData())}updateData(){var a=arguments,b=this;return Ca(function*(){var{config:c}=0b.updateEntity(a,c,e,d));yield Promise.all(f)}catch(a){Lf(a)}if(c.show.graph&&b.entity.forEach((a,c)=>{a&&b.Graph[c].update()}),b.updateBounds(),c.show.graph){var g=0;b.entity.forEach((a,d)=>{if(a&&0!==b.Graph[d].coords.length){var e="secondary"===c.entities[d].y_axis?b.boundSecondary:b.bound;if([b.Graph[d].min,b.Graph[d].max]=[e[0],e[1]],"bar"===c.show.graph){var f=b.visibleEntities.length;b.bar[d]=b.Graph[d].getBars(g,f,c.bar_spacing),g+=1}else{var h=b.Graph[d].getPath();!1!==c.entities[d].show_line&&(b.line[d]=h),c.show.fill&&!1!==c.entities[d].show_fill&&(b.fill[d]=b.Graph[d].getFill(h)),c.show.points&&!1!==c.entities[d].show_points&&(b.points[d]=b.Graph[d].getPoints()),0b[a])))||d:"~"===c[0]?Math[a].apply(Math,[+c.substr(1)].concat(Da(b.map(b=>b[a])))):c}getBoundaries(a,b,c,d,e){var f=[this.getBoundary("min",a,b,d[0]),this.getBoundary("max",a,c,d[1])];if(e){var g=ec(f[0]-f[1]),h=parseFloat(e)-g;if(0c!=="".concat(a.entity_id,"-").concat(b));var f=[],g=c,h=!1,i=null;if(e.config.cache&&e.cache){var n=e.cache.generateKey(a.entity_id,c,d,{hours_to_show:e.config.hours_to_show,points_per_hour:e.config.points_per_hour,index:b});i=yield e.cache.get(n),i&&i.hours_to_show===e.config.hours_to_show&&(f=i.data,e.cache.prefetch(a.entity_id))}else e.config.cache&&(i=yield e.getCache("".concat(a.entity_id,"_").concat(b),e.config.useCompress),i&&i.hours_to_show===e.config.hours_to_show&&(f=i.data));if(0new Date(a.last_changed)>c);-1===o?f=[]:(0g&&(g=new Date(p-1))}var j=yield e.fetchRecent(a.entity_id,g,d,!e.config.entities[b].attribute&&h,!!e.config.entities[b].attribute);if(j[0]&&0{e.config.entities[b].attribute&&(a.state=e.getObjectAttr(a.attributes,e.config.entities[b].attribute),delete a.attributes),0!$b(parseFloat(a.state))),j=j.map(a=>({last_changed:e.config.entities[b].attribute?a.last_updated:a.last_changed,state:a.state})),f=[].concat(Da(f),Da(j)),e.config.cache))if(e.cache){var k=e.cache.generateKey(a.entity_id,c,d,{hours_to_show:e.config.hours_to_show,points_per_hour:e.config.points_per_hour,index:b}),l={hours_to_show:e.config.hours_to_show,last_fetched:new Date,data:f,version:"0.21.1",entity_id:a.entity_id,index:b},m=1e3{Lf(a),Xd.clear()});if(0!==f.length)if(e.entity[0]&&a.entity_id===e.entity[0].entity_id&&e.updateExtrema(f),!0===e.config.entities[b].fixed_value){var q=f[f.length-1];e.Graph[b].history=[q,q]}else e.Graph[b].history=f}})()}fetchRecent(a,b,c,d,e){var f=this;return Ca(function*(){var g="history/period";return b&&(g+="/".concat(b.toISOString())),g+="?filter_entity_id=".concat(a),c&&(g+="&end_time=".concat(c.toISOString())),d&&(g+="&skip_initial_state"),e||(g+="&minimal_response&no_attributes"),e&&(g+="&significant_changes_only=0"),f._hass.callApi("GET",g)})()}updateExtrema(a){var{extrema:b,average:c}=this.config.show;this.abs=[].concat(Da(b?[xa({type:"min"},Cf(a,"state"))]:[]),Da(c?[{type:"avg",state:Df(a,"state")}]:[]),Da(b?[xa({type:"max"},Ef(a,"state"))]:[]))}_convertState(a){var b=this.config.state_map.findIndex(b=>b.value===a.state);-1===b||(a.state=b)}getEndDate(){var a=new Date;switch(this.config.group_by){case"date":a.setDate(a.getDate()+1),a.setHours(0,0,0);break;case"hour":a.setHours(a.getHours()+1),a.setMinutes(0,0);}return a}setNextUpdate(){if(!this.config.update_interval){var a=1/this.config.points_per_hour;clearInterval(this.interval),this.interval=setInterval(()=>{this.updating||this.updateData()},a*tf)}}getCardSize(){return 3}}ag.getConfigElement=function(){return document.createElement("mini-graph-card-editor")},ag.getStubConfig=()=>({type:"custom:mini-graph-card",entity:"sensor.example"}),customElements.define("mini-graph-card",ag),window.customCards=window.customCards||[],window.customCards.push({type:"mini-graph-card",name:"Mini Graph Card",preview:!1,description:"The Mini Graph card is a minimalistic and customizable graph card"})})})(); diff --git a/dist/mini-graph-card-editor.js b/dist/mini-graph-card-editor.js new file mode 100644 index 00000000..e57219a6 --- /dev/null +++ b/dist/mini-graph-card-editor.js @@ -0,0 +1,4680 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MiniGraphCardEditor = factory()); +}(this, (function () { 'use strict'; + + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + /** + * True if the custom elements polyfill is in use. + */ + const isCEPolyfill = typeof window !== 'undefined' && + window.customElements != null && + window.customElements.polyfillWrapFlushCallback !== + undefined; + /** + * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from + * `container`. + */ + const removeNodes = (container, start, end = null) => { + while (start !== end) { + const n = start.nextSibling; + container.removeChild(start); + start = n; + } + }; + + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + /** + * An expression marker with embedded unique key to avoid collision with + * possible text in templates. + */ + const marker = `{{lit-${String(Math.random()).slice(2)}}}`; + /** + * An expression marker used text-positions, multi-binding attributes, and + * attributes with markup-like text values. + */ + const nodeMarker = ``; + const markerRegex = new RegExp(`${marker}|${nodeMarker}`); + /** + * Suffix appended to all bound attribute names. + */ + const boundAttributeSuffix = '$lit$'; + /** + * An updatable Template that tracks the location of dynamic parts. + */ + class Template { + constructor(result, element) { + this.parts = []; + this.element = element; + const nodesToRemove = []; + const stack = []; + // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null + const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false); + // Keeps track of the last index associated with a part. We try to delete + // unnecessary nodes, but we never want to associate two different parts + // to the same index. They must have a constant node between. + let lastPartIndex = 0; + let index = -1; + let partIndex = 0; + const { strings, values: { length } } = result; + while (partIndex < length) { + const node = walker.nextNode(); + if (node === null) { + // We've exhausted the content inside a nested template element. + // Because we still have parts (the outer for-loop), we know: + // - There is a template in the stack + // - The walker will find a nextNode outside the template + walker.currentNode = stack.pop(); + continue; + } + index++; + if (node.nodeType === 1 /* Node.ELEMENT_NODE */) { + if (node.hasAttributes()) { + const attributes = node.attributes; + const { length } = attributes; + // Per + // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap, + // attributes are not guaranteed to be returned in document order. + // In particular, Edge/IE can return them out of order, so we cannot + // assume a correspondence between part index and attribute index. + let count = 0; + for (let i = 0; i < length; i++) { + if (endsWith(attributes[i].name, boundAttributeSuffix)) { + count++; + } + } + while (count-- > 0) { + // Get the template literal section leading up to the first + // expression in this attribute + const stringForPart = strings[partIndex]; + // Find the attribute name + const name = lastAttributeNameRegex.exec(stringForPart)[2]; + // Find the corresponding attribute + // All bound attributes have had a suffix added in + // TemplateResult#getHTML to opt out of special attribute + // handling. To look up the attribute value we also need to add + // the suffix. + const attributeLookupName = name.toLowerCase() + boundAttributeSuffix; + const attributeValue = node.getAttribute(attributeLookupName); + node.removeAttribute(attributeLookupName); + const statics = attributeValue.split(markerRegex); + this.parts.push({ type: 'attribute', index, name, strings: statics }); + partIndex += statics.length - 1; + } + } + if (node.tagName === 'TEMPLATE') { + stack.push(node); + walker.currentNode = node.content; + } + } + else if (node.nodeType === 3 /* Node.TEXT_NODE */) { + const data = node.data; + if (data.indexOf(marker) >= 0) { + const parent = node.parentNode; + const strings = data.split(markerRegex); + const lastIndex = strings.length - 1; + // Generate a new text node for each literal section + // These nodes are also used as the markers for node parts + for (let i = 0; i < lastIndex; i++) { + let insert; + let s = strings[i]; + if (s === '') { + insert = createMarker(); + } + else { + const match = lastAttributeNameRegex.exec(s); + if (match !== null && endsWith(match[2], boundAttributeSuffix)) { + s = s.slice(0, match.index) + match[1] + + match[2].slice(0, -boundAttributeSuffix.length) + match[3]; + } + insert = document.createTextNode(s); + } + parent.insertBefore(insert, node); + this.parts.push({ type: 'node', index: ++index }); + } + // If there's no text, we must insert a comment to mark our place. + // Else, we can trust it will stick around after cloning. + if (strings[lastIndex] === '') { + parent.insertBefore(createMarker(), node); + nodesToRemove.push(node); + } + else { + node.data = strings[lastIndex]; + } + // We have a part for each match found + partIndex += lastIndex; + } + } + else if (node.nodeType === 8 /* Node.COMMENT_NODE */) { + if (node.data === marker) { + const parent = node.parentNode; + // Add a new marker node to be the startNode of the Part if any of + // the following are true: + // * We don't have a previousSibling + // * The previousSibling is already the start of a previous part + if (node.previousSibling === null || index === lastPartIndex) { + index++; + parent.insertBefore(createMarker(), node); + } + lastPartIndex = index; + this.parts.push({ type: 'node', index }); + // If we don't have a nextSibling, keep this node so we have an end. + // Else, we can remove it to save future costs. + if (node.nextSibling === null) { + node.data = ''; + } + else { + nodesToRemove.push(node); + index--; + } + partIndex++; + } + else { + let i = -1; + while ((i = node.data.indexOf(marker, i + 1)) !== -1) { + // Comment node has a binding marker inside, make an inactive part + // The binding won't work, but subsequent bindings will + // TODO (justinfagnani): consider whether it's even worth it to + // make bindings in comments work + this.parts.push({ type: 'node', index: -1 }); + partIndex++; + } + } + } + } + // Remove text binding nodes after the walk to not disturb the TreeWalker + for (const n of nodesToRemove) { + n.parentNode.removeChild(n); + } + } + } + const endsWith = (str, suffix) => { + const index = str.length - suffix.length; + return index >= 0 && str.slice(index) === suffix; + }; + const isTemplatePartActive = (part) => part.index !== -1; + // Allows `document.createComment('')` to be renamed for a + // small manual size-savings. + const createMarker = () => document.createComment(''); + /** + * This regex extracts the attribute name preceding an attribute-position + * expression. It does this by matching the syntax allowed for attributes + * against the string literal directly preceding the expression, assuming that + * the expression is in an attribute-value position. + * + * See attributes in the HTML spec: + * https://www.w3.org/TR/html5/syntax.html#elements-attributes + * + * " \x09\x0a\x0c\x0d" are HTML space characters: + * https://www.w3.org/TR/html5/infrastructure.html#space-characters + * + * "\0-\x1F\x7F-\x9F" are Unicode control characters, which includes every + * space character except " ". + * + * So an attribute is: + * * The name: any character except a control character, space character, ('), + * ("), ">", "=", or "/" + * * Followed by zero or more space characters + * * Followed by "=" + * * Followed by zero or more space characters + * * Followed by: + * * Any character except space, ('), ("), "<", ">", "=", (`), or + * * (") then any non-("), or + * * (') then any non-(') + */ + const lastAttributeNameRegex = + // eslint-disable-next-line no-control-regex + /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/; + + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */; + /** + * Removes the list of nodes from a Template safely. In addition to removing + * nodes from the Template, the Template part indices are updated to match + * the mutated Template DOM. + * + * As the template is walked the removal state is tracked and + * part indices are adjusted as needed. + * + * div + * div#1 (remove) <-- start removing (removing node is div#1) + * div + * div#2 (remove) <-- continue removing (removing node is still div#1) + * div + * div <-- stop removing since previous sibling is the removing node (div#1, + * removed 4 nodes) + */ + function removeNodesFromTemplate(template, nodesToRemove) { + const { element: { content }, parts } = template; + const walker = document.createTreeWalker(content, walkerNodeFilter, null, false); + let partIndex = nextActiveIndexInTemplateParts(parts); + let part = parts[partIndex]; + let nodeIndex = -1; + let removeCount = 0; + const nodesToRemoveInTemplate = []; + let currentRemovingNode = null; + while (walker.nextNode()) { + nodeIndex++; + const node = walker.currentNode; + // End removal if stepped past the removing node + if (node.previousSibling === currentRemovingNode) { + currentRemovingNode = null; + } + // A node to remove was found in the template + if (nodesToRemove.has(node)) { + nodesToRemoveInTemplate.push(node); + // Track node we're removing + if (currentRemovingNode === null) { + currentRemovingNode = node; + } + } + // When removing, increment count by which to adjust subsequent part indices + if (currentRemovingNode !== null) { + removeCount++; + } + while (part !== undefined && part.index === nodeIndex) { + // If part is in a removed node deactivate it by setting index to -1 or + // adjust the index as needed. + part.index = currentRemovingNode !== null ? -1 : part.index - removeCount; + // go to the next active part. + partIndex = nextActiveIndexInTemplateParts(parts, partIndex); + part = parts[partIndex]; + } + } + nodesToRemoveInTemplate.forEach((n) => n.parentNode.removeChild(n)); + } + const countNodes = (node) => { + let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1; + const walker = document.createTreeWalker(node, walkerNodeFilter, null, false); + while (walker.nextNode()) { + count++; + } + return count; + }; + const nextActiveIndexInTemplateParts = (parts, startIndex = -1) => { + for (let i = startIndex + 1; i < parts.length; i++) { + const part = parts[i]; + if (isTemplatePartActive(part)) { + return i; + } + } + return -1; + }; + /** + * Inserts the given node into the Template, optionally before the given + * refNode. In addition to inserting the node into the Template, the Template + * part indices are updated to match the mutated Template DOM. + */ + function insertNodeIntoTemplate(template, node, refNode = null) { + const { element: { content }, parts } = template; + // If there's no refNode, then put node at end of template. + // No part indices need to be shifted in this case. + if (refNode === null || refNode === undefined) { + content.appendChild(node); + return; + } + const walker = document.createTreeWalker(content, walkerNodeFilter, null, false); + let partIndex = nextActiveIndexInTemplateParts(parts); + let insertCount = 0; + let walkerIndex = -1; + while (walker.nextNode()) { + walkerIndex++; + const walkerNode = walker.currentNode; + if (walkerNode === refNode) { + insertCount = countNodes(node); + refNode.parentNode.insertBefore(node, refNode); + } + while (partIndex !== -1 && parts[partIndex].index === walkerIndex) { + // If we've inserted the node, simply adjust all subsequent parts + if (insertCount > 0) { + while (partIndex !== -1) { + parts[partIndex].index += insertCount; + partIndex = nextActiveIndexInTemplateParts(parts, partIndex); + } + return; + } + partIndex = nextActiveIndexInTemplateParts(parts, partIndex); + } + } + } + + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const directives = new WeakMap(); + const isDirective = (o) => { + return typeof o === 'function' && directives.has(o); + }; + + /** + * @license + * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + /** + * A sentinel value that signals that a value was handled by a directive and + * should not be written to the DOM. + */ + const noChange = {}; + /** + * A sentinel value that signals a NodePart to fully clear its content. + */ + const nothing = {}; + + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + /** + * An instance of a `Template` that can be attached to the DOM and updated + * with new values. + */ + class TemplateInstance { + constructor(template, processor, options) { + this.__parts = []; + this.template = template; + this.processor = processor; + this.options = options; + } + update(values) { + let i = 0; + for (const part of this.__parts) { + if (part !== undefined) { + part.setValue(values[i]); + } + i++; + } + for (const part of this.__parts) { + if (part !== undefined) { + part.commit(); + } + } + } + _clone() { + // There are a number of steps in the lifecycle of a template instance's + // DOM fragment: + // 1. Clone - create the instance fragment + // 2. Adopt - adopt into the main document + // 3. Process - find part markers and create parts + // 4. Upgrade - upgrade custom elements + // 5. Update - set node, attribute, property, etc., values + // 6. Connect - connect to the document. Optional and outside of this + // method. + // + // We have a few constraints on the ordering of these steps: + // * We need to upgrade before updating, so that property values will pass + // through any property setters. + // * We would like to process before upgrading so that we're sure that the + // cloned fragment is inert and not disturbed by self-modifying DOM. + // * We want custom elements to upgrade even in disconnected fragments. + // + // Given these constraints, with full custom elements support we would + // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect + // + // But Safari does not implement CustomElementRegistry#upgrade, so we + // can not implement that order and still have upgrade-before-update and + // upgrade disconnected fragments. So we instead sacrifice the + // process-before-upgrade constraint, since in Custom Elements v1 elements + // must not modify their light DOM in the constructor. We still have issues + // when co-existing with CEv0 elements like Polymer 1, and with polyfills + // that don't strictly adhere to the no-modification rule because shadow + // DOM, which may be created in the constructor, is emulated by being placed + // in the light DOM. + // + // The resulting order is on native is: Clone, Adopt, Upgrade, Process, + // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade + // in one step. + // + // The Custom Elements v1 polyfill supports upgrade(), so the order when + // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update, + // Connect. + const fragment = isCEPolyfill ? + this.template.element.content.cloneNode(true) : + document.importNode(this.template.element.content, true); + const stack = []; + const parts = this.template.parts; + // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null + const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false); + let partIndex = 0; + let nodeIndex = 0; + let part; + let node = walker.nextNode(); + // Loop through all the nodes and parts of a template + while (partIndex < parts.length) { + part = parts[partIndex]; + if (!isTemplatePartActive(part)) { + this.__parts.push(undefined); + partIndex++; + continue; + } + // Progress the tree walker until we find our next part's node. + // Note that multiple parts may share the same node (attribute parts + // on a single element), so this loop may not run at all. + while (nodeIndex < part.index) { + nodeIndex++; + if (node.nodeName === 'TEMPLATE') { + stack.push(node); + walker.currentNode = node.content; + } + if ((node = walker.nextNode()) === null) { + // We've exhausted the content inside a nested template element. + // Because we still have parts (the outer for-loop), we know: + // - There is a template in the stack + // - The walker will find a nextNode outside the template + walker.currentNode = stack.pop(); + node = walker.nextNode(); + } + } + // We've arrived at our part's node. + if (part.type === 'node') { + const part = this.processor.handleTextExpression(this.options); + part.insertAfterNode(node.previousSibling); + this.__parts.push(part); + } + else { + this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options)); + } + partIndex++; + } + if (isCEPolyfill) { + document.adoptNode(fragment); + customElements.upgrade(fragment); + } + return fragment; + } + } + + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + /** + * Our TrustedTypePolicy for HTML which is declared using the html template + * tag function. + * + * That HTML is a developer-authored constant, and is parsed with innerHTML + * before any untrusted expressions have been mixed in. Therefor it is + * considered safe by construction. + */ + const policy = window.trustedTypes && + trustedTypes.createPolicy('lit-html', { createHTML: (s) => s }); + const commentMarker = ` ${marker} `; + /** + * The return type of `html`, which holds a Template and the values from + * interpolated expressions. + */ + class TemplateResult { + constructor(strings, values, type, processor) { + this.strings = strings; + this.values = values; + this.type = type; + this.processor = processor; + } + /** + * Returns a string of HTML used to create a `